0
我的字符串看起來像如何刪除一些字符形成一個變量PHP
$string_value = /hello/world/this/feels/great/
我怎麼能修剪的世界,感覺非常的輸出樣子?
$string_value = /hello/this/great/
感謝
我的字符串看起來像如何刪除一些字符形成一個變量PHP
$string_value = /hello/world/this/feels/great/
我怎麼能修剪的世界,感覺非常的輸出樣子?
$string_value = /hello/this/great/
感謝
<?php
$string_value = '/hello/world/this/feels/great/';
$string_value = str_replace(array('world/', 'feels/'), '', $string_value);
echo $string_value;
這就是簡單的方法。
['str_replace()'](http://php.net/manual/en/function.str-replace.php) – JJJ
您擁有的代碼將不起作用,字符串必須用單引號或雙引號括起來。並在最後放置一個semilocon。 –