如何用php生成可以用javascript输出的合法字符串??? http://www.dev-club.com/club/bbs/showEssence.asp?id=20696 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 \/\"\'在输出到客户端前在服务器用php replace一下<?php$string = "hello,cloud'chen\". how / are you";$string = toJs($string);function toJs($string) { return preg_replace("/(['\"\/])/","\\\\$1",$string);}?><SCRIPT>alert("<?=$string?>");</SCRIPT> .htaccess 域名指向 php [分享]从dl('xxx.so');函数分析PHP模块开发 PHP + MYSQL编码问题 iis下运行php出现No input file specified php几大怪问题——最近怎么总碰到,难道是本命年的原因? 关于数据库查询更新的问题 关于框架的问题 请教关于cookie的问题 在php+mysql中能不能把数据库文件放到别的目录下! 急 象Google一样! 怎样得出符合条件的记录行数?
\"
\'在输出到客户端前在服务器用php replace一下<?php
$string = "hello,cloud'chen\". how / are you";
$string = toJs($string);function toJs($string) {
return preg_replace("/(['\"\/])/","\\\\$1",$string);
}
?>
<SCRIPT>
alert("<?=$string?>");
</SCRIPT>