到運行的sed做多的搜索,並與下面的字符串執行多的sed在PHP中:我試圖逃避問題
$test = "sed -n '1h;1!H;${;g;s/iname=\"".$name.".*item>/".trim(xml)."/g;p;}' ".$file;
exec($test,$cmdresult);
sed的替換是選擇,因爲要搜索的字符串是超過10 MB。
在執行過程中的編譯器會發出警告
PHP Parse error: syntax error, unexpected ';'
如何去解決呢?
您可能會發現`<<< HEREDOC`語法最終會變得更人性化。 http://ca.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc – dnagirl 2011-02-15 18:24:59