WordPressから吐き出されたaタグ内の文字を置換したいのですがstr_replace()が動きません。
何が原因なのでしょうか..
PHP
1 2$replace_names = do_shortcode("[category]"); 3※変数をvar_dump()すると、 4--------- 5C:\xampp\htdocs\~~~~略 : eval()'d code:9:string '<a href="http://localhost/column/" rel="category tag">COLUMN</a><a href="http://localhost/essay/" rel="category tag">ESSAY</a><a href="http://localhost/interview/" rel="category tag">INTERVIEW</a>' 6---------- 7 8$search = array('NEWS','COLUMN','INTERVIEW'); 9$replace = array('ニュース','コラム','インタビュー'); 10$replaced_str = str_replace($search,$replace,$replace_names); 11
出力結果(何も変わりませんでした)
PHP
1--------- 2C:\xampp\htdocs\~~~~略 : eval()'d code:9:string '<a href="http://localhost/column/" rel="category tag">COLUMN</a><a href="http://localhost/essay/" rel="category tag">ESSAY</a><a href="http://localhost/interview/" rel="category tag">INTERVIEW</a>' 3----------
ご教授頂けましたら幸いですmm
回答3件
あなたの回答
tips
プレビュー