PHP:出于安全原因,readfile() 已被禁用
我编写了一个 php 脚本,它使用 readfile($htmlFile); 在屏幕上输出 html 文件。 然而,在我购买的网络托管中,出于安全原因,readfile() 已被禁用。 是否有 readfile() 的替代品(其他 php 函数),或者我别无选择,只能要求管理员为我启用它?
谢谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用以下方法检查哪些功能被禁用:
您可以尝试使用 fopen() 和 fread() 代替:
http://nl2.php.net/manual/en/function.fopen.php
http://nl2.php.net/manual/en/function.fread.php
或 fopen() 和 fpassthru()
或者您可以使用 fwrite() 写入内容。
您还可以尝试使用 file_get_contents()
http://nl2.php.net/file_get_contents
或者您可以使用 file()
http://nl2.php.net/manual/en/function.file.php
我不会推荐这种方法,但如果没有效果......
You can check which functions are disabled by using:
You can try to use fopen() and fread() instead:
http://nl2.php.net/manual/en/function.fopen.php
http://nl2.php.net/manual/en/function.fread.php
Or fopen() with fpassthru()
Alternatively you can use fwrite() to write content.
You can also try to use file_get_contents()
http://nl2.php.net/file_get_contents
Or you can use file()
http://nl2.php.net/manual/en/function.file.php
I wouldn't recommend this method though, but if nothing works...
如果它被禁用,那么您可以执行以下操作作为替代:
希望它有帮助
If its disabled then you could do something like following as alternative:
Hope it helps
您可以尝试:
You can try :