寻找我的问题的解决方案。 搜索这个地方和谷歌的答案,但不能获得太多的理由。php ltrim不抓取开始破折号
基本上我想从标题中删除“Issue 119 - ”。
到目前为止,我得到了“问题119”被删除,但“ - ”是可悲的 任何人都可以帮助我。会喜欢它,如果我可以修改$ cut变量线
$ grissueno来自我的wordpress post = 119字符串中的自定义字段。
the_title呈现字符串 “问题119 - 编辑:四面”(如题)
<?php
$cut = "Issue " . $grissueno; //joining the word issue and dynamic number together
$title = the_title('','',false); //telling wordpress to let php use the title string
$trim = str_replace($cut, "", $title); //cutting out the Issue 119
echo ltrim($trim, " - "); //trying to remove the dash but failing
?>
感谢您的帮助
http://php.net/manual/en/function也许审查。 ltrim.php会帮助 –
对不起,我注意到我发布了一个编辑代码试图加载不同的东西,我发布之前认为它是str_replace:/ echo ltrim($ trim,“ - ”); – Trevor