尋找我的問題的解決方案。 搜索這個地方和谷歌的答案,但不能獲得太多的理由。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