$string="how-3981-make-scarecrow";
$test = str_replace("-", " ", $string);
echo $test;
这里我想删除带有空格的破折号,但这不起作用。任何人都可以帮助我。
这可以在php中删除此..
由于
答案 0 :(得分:4)
你错过了回音中的美元符号
$string="how-3981-make-scarecrow";
$test = str_replace("-", " ", $string);
echo $test;
顺便说一句,有很多SO链接有类似的问题:
答案 1 :(得分:0)
它工作正常。请参考下面的代码。
echo $string = "how-3981-make-scarecrow";
$test = str_replace( "-", " ", $string );
echo $test;
答案 2 :(得分:0)
试试这个工作正常
$string="Hello-See-This-Is-Working";
$result = str_replace("-", "", $string);
echo $result;
$string="Hello-See-This-Is-Working";
$result = str_replace("-", " ", $string);
echo $result;
$string="Hello-See-This-Is-Working";
$result = str_replace("-", " ", $string);
echo $result;
结果
HelloSeeThisIsWorking
Hello See This Is Working
Hello See This Is Working