zend studio代码显示
- PHP code
<html><head><title></title><script type='text/javascript'> function xx(){ var ii; ii = 'F'; alert(ii); <?php $tt =1; if ($tt==1) { ?> var cc; cc = 'P'; alert(cc); <?php } ?> var uu; uu = 'weiweipxbuu' alert(uu); }</script></head><body><input type='button' value = 'Hit Me' onClick = "xx()"></body></html> 在js中嵌入php代码后,这段php代码后面的js代码字体都变成了黑色的。虽然没有错误但是不便宜阅读。
[解决办法]
那种ide都没有办法很好的处理的这2种语法相交叉的使用,或者你可以这样用
- HTML code
<html><head><title></title><script type='text/javascript'> function xx(){ var ii; ii = 'F'; alert(ii); /**<?php $tt =1; if ($tt==1) { ?>**/ var cc; cc = 'P'; alert(cc); /**<?php } ?>**/ var uu; uu = 'weiweipxbuu' alert(uu); }</script></head><body><input type='button' value = 'Hit Me' onClick = "xx()"></body></html>