我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

从文件php加载数据时,在文件中运行HTML代码。 如何忽略它

One of my file is read by php and loaded on the Web UI. But if the file contains HTML tags, it interprets and disturbs the whole UI. How to ignore the HTML tags while reading the file contents.

I am using following code to read file contents: readfile($name);

I think what you are looking for is htmlspecialchars function.

e.g. echo htmlspecialchars($stringFile);

If you want to strip all html tags, check strip_tags function.

近期文章

  • 如何将ios应用程序中的数据上传到我的sql数据库?
  • 通过代码将多个域添加到一个Web应用程序
  • 处理测验脚本,需要通过php计算结果,遇到搜索$ _POST的问题
  • 如何进一步过滤搜索步骤的结果?
  • 我从phpmailer收到此错误消息无法发送.Mailer错误:SMTP connect()失败?
  • 使用php从docx文件中提取文本时忽略文本引用/引用
  • 为什么这会发生在substr空间[重复]
  • 检测文件中的空行
  • 如何在Safari中显示Google字体?
  • MySQL - 在不同的查询中执行选择和删除?
  • 使用PHP中的数据表计数和最大值
  • 在mysql中使用SET @var_name给出语法错误
  • Wordpress API - 随机发帖
  • PHP Base64_decode
  • 如何使用数组更新
  • Symfony中的复合主键
  • 将PHP中的esc_html命令与HTML结合使用
  • 为jQuery日历编码JSON
  • 我能得到一个如何进行SQL注入的例子吗? [关闭]
  • PHP CURL Ping函数与现有主机失败

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华