转义字符串时出错
I have an error when I escaping string
我正试图在面板中的php代码中编写一个字符串。这在下给出
<?php
$str.="$('#layerList ul').prepend('<li data-refInd='''+arr_ind+'''><img src='''tmp_card_imgs/''+temp".$k.".name+''' width='20px' /> Layer '+temp".$k.".zindex+':Image <span class=''del_layer'' style=''cursor:pointer;float:right;display:block;''>X</span></li>');";
?>
但控制台中显示的错误在下给出
SyntaxError: missing ) after argument list
[Break On This Error]
...data-refInd='''+arr_ind+'''><img src='''tmp_card_imgs/''+temp0.name+''' width='2...
-----------------------------------------|
editor.php?id=129 (line 837, col 60)
我的字符串转义有什么问题?
这里有问题:
<img src='''tmp_card_imgs/''+temp0.name+'''
// ^ ^
应该是
<img src=''tmp_card_imgs/'+temp0.name+'''
你还没逃脱
width='20px'
应该是
width=''20px''
最终结果:
<?php
$str.="$('#layerList ul').prepend('<li data-refInd='''+arr_ind+'''><img src=''tmp_card_imgs/'+temp".$k.".name+''' width=''20px'' /> Layer '+temp".$k.".zindex+':Image <span class=''del_layer'' style=''cursor:pointer;float:right;display:block;''>X</span></li>');";
?>
$str .= "$('#layerList ul').prepend('<li data-refInd='"'+arr_ind+''"><img src='"tmp_card_imgs/'+temp".$k.".name+''" width='20px' /> Layer '+temp".$k.".zindex+':Image <span class='"del_layer'" style='"cursor:pointer;float:right;display:block;'">X</span></li>');";
相关文章:
- 比较Javascript中的两个字符串时出错
- 尝试组合字符串时出错
- 解析从js发送到Java的json字符串时出错
- 在javascript中将字符串转换为int时出错
- 根据64字符串绘制画布图片时出错
- angularjs[ng:areq]参数'fn'不是函数,在控制台中获取字符串时出错
- WebSQL:处理SQL时出错:数量为''语句字符串中的s与参数计数不匹配
- 在 AngularJS 中将字符串转换为对象时出错
- NaN Javascript 和 Jquery 尝试连接数字和字符串时出错
- 将对象转换为字符串 Javascript 时出错
- 在 ES6 中扩展字符串时出错
- 将字符串中的方括号文字与JS正则表达式匹配时出错
- 将字符串变量传递给方法时出错
- NodeJS Bug?执行在要返回的字符串之前带有换行符的返回语句时出错
- 在javascript中连接utf字符串时出错
- 转义字符串时出错
- 敲除js时出错字符串不是函数
- JQuery比较字符串时出错
- 使用JQuery解析JSON字符串时出错
- 将字符串转换为json对象时出错