doureng1083 2016-05-07 07:14
浏览 14

不能通过PHP包含文件

I am uploading a navigation bar called nav.html and I would like to use PHP 7 to include this file at the top of all my pages.

This code: <?php include '/home/u783318484/public_html/nav.html';?> returns the error message,

Warning: include(/home/u783318484/public_html/nav.html): failed to open stream: No such file or directory in /home/u783318484/public_html/apply.php on line 24

Warning: include(): Failed opening '/home/u783318484/public_html/nav.html' for inclusion (include_path='.:/opt/php-7.0/pear') in /home/u783318484/public_html/apply.php on line 24

It works fine on my PC with Apache, but when I upload it to my website (hosted by Hostinger) it does this. The nav.html is in the same folder as the other pages.

  • 写回答

3条回答 默认 最新

  • douti8321 2016-05-07 07:15
    关注

    Check your path and try with this

    <?php include(dirname(__FILE__).'/nav.html');?>
    
    评论

报告相同问题?

悬赏问题

  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败