rtrim function doesn't work with ending h letter

前端 未结 5 832
感动是毒
感动是毒 2021-01-26 04:26
$file = \"refinish.php\";
$folder = rtrim($file, \".php\");
echo $folder; // refinis

where is ending h ?

I tried with some other

5条回答
  •  余生分开走
    2021-01-26 05:09

    You Try code

    $filename = "refinish.php";
    $extension_pos = strrpos($filename , '.');  
    $file = substr($filename, 0, $extension_pos) ;
    
    $folder = str_replace('.','',rtrim( $file , "php"));
    echo $folder.substr($filename, $extension_pos);
    

    its working fine . its output is refinis.php

提交回复
热议问题