我的文件中有这行代码,但在返回数组部分,我需要在数组中加双引号。
如果我现在离开它,它会崩溃。
我该如何解决这个问题?
if ($number_of_picture_allowed <= $number_of_picture)
return array('error' => "{tr domain="PhrasesInTemplates"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);
先谢谢, Arky
答案 0 :(得分:1)
您可以使用\
转义数组内的引号 return array('error' => "{tr domain=\"PhrasesInTemplates\"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);
答案 1 :(得分:1)
使用反斜杠(\
)转义这些引号。因此,你的回报应该是:
return array('error' => "{tr domain=\"PhrasesInTemplates\"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);
答案 2 :(得分:1)
if ($number_of_picture_allowed <= $number_of_picture)
return array('error' => "{tr domain=\"PhrasesInTemplates\"}You already selected the maximum amount of pictures for this shirt!{/tr}",'file_sid' => $fileSid);
试试这个。 PHP Double Quotes
答案 3 :(得分:0)
试试这个:
用单引号包装内容
$arr = array('error' => '{tr domain="PhrasesInTemplates"}You already selected the maximum amount of pictures for this shirt!{/tr}','file_sid' => $fileSid);
使用反斜杠(\)\“