我不知道這裏的概率是什麼!我從這個函數中得到一個錯誤preg_replace?
function remove_wp_width_height($string){
return preg_replace('/\/i', "",$string);
}
echo remove_wp_width_height(get_the_post_thumbnail($post->ID,'large'));
錯誤:
Warning: preg_replace(): No ending delimiter '/' found in /var/www/wp332/wp-content/plugins/mashable_menu/index.php on line 272
我嘗試調整WordPress的圖像
感謝高級
請笑w示例輸入和輸出字符串。如果你想要做的只是從字符串中去掉反斜槓(看起來是這樣),不需要正則表達式 - 一個簡單的'str_replace('\\','',$ string);'會做。 – DaveRandom
您需要在正則表達式中跳過反斜槓:''/ \\/i'' –