-5

たとえば、CodeIgniterの文字列を置き換えるためのコマンドは何ですか

元の文字列はwww.example.com/imges/fraudsite.htmlです。

置換文字列はwww.example.com/imges/fraudsite.zipです。

後にすべてを置き換えたい(ドット)

ありがとうSodmeb

4

2 に答える 2

3

You should be more precise with explaining what you want. If you want a route - use routes.php file to reroute the original URL to your replacement, either than that - use what @vascowhite suggested in his comment to your question.

If it's routing that you need, in your routes.php file in config folder of your application add a line:

$route['imges/fraudsite.zip'] = "imges/fraudsite.html";

If it's just the string you want:

$string = "www.example.com/imges/fraudsite.html";
$string = str_replace(".html", ".zip", $string);

As you have noted in the comments, you need to change everything that goes beyond the last dot to zip, you have to use:

$str = "www.example.com/imges/fraudsite.html";
$str = substr($str, 0, strrpos($str, '.', -1)).".zip";
于 2012-09-20T18:31:13.347 に答える
0

$ test = "Hello world!";

$test = word_censor($test,"Hello","Bye");

echo $test;

//Bye world!
于 2012-09-20T18:31:52.060 に答える