douan4106 2012-03-11 09:19
浏览 9
已采纳

停用解析器以查找页面中的某个特殊位置

how can deactivate parser for some special place in the page ,
for example if i have some php or javascript code in my database , and retrieve them in page, they do not execute!!
another example is facebook status ,when it post ,facebook ignore any kind of code like html,php,javascript and etc

for example : i have this :

<?php for($i=0 ; i <= 5 ; i++){ echo $i; }?>;

then i see smth like this in browser :

012345

how can i prevent executaion of this code (instate of 012345 , show me <?php for($i=0 ; i <= 5 ; i++){ echo $i; }?>;)

  • 写回答

1条回答 默认 最新

  • dqy27359 2012-03-11 11:28
    关注

    Just guessing that you're talking about escaping HTML:

    echo htmlspecialchars($stringContainingCode);
    

    See http://php.net/htmlspecialchars and The Great Escapism (Or: What You Need To Know To Work With Text Within Text).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度