douti8321 2014-04-16 16:52 采纳率: 0%
浏览 36

如何允许一个文件夹中的文件从另一个文件夹访问文件?

I am currently coding a website and I have a global sidebar. I want every file to have the sidebar and just be able to update my sidebar.php and everything will change, but when I put in

<div><?php include 'sidebar.php'; ?></div>

it doesn't work. I've also tried

<div><?php include 'jophnist.x10.bz/sidebar.php'; ?></div>

Whenever I do that though, it gives me this warning.

Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/jophnist/public_html/games/index.php on line 5

Warning: include(http://jophnist.x10.bz/sidebar.php): failed to open stream: no suitable wrapper could be found in /home/jophnist/public_html/games/index.php on line 5

Warning: include(): Failed opening 'http://jophnist.x10.bz/sidebar.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jophnist/public_html/games/index.php on line 5

What do I do? When I try

<iframe src="http://jophnist.x10.bz/sidebar.php" seamless></iframe>

it works, although it is too small and the words in the file don't go in the sidebar.

  • 写回答

1条回答 默认 最新

  • dsiy62758 2014-04-16 17:00
    关注

    I couldn't see your include statement in the question above. But I assume that it's something like:

    include('http://jophnist.x10.bz/sidebar.php');
    

    Is that right? If so, instead of passing a url to include, pass a relative path to the sidebar.php file from the current file. If they are in the same directory, use:

    include('sidebar.php');
    

    or say for example the files from which you're including sidebar.php are in a subdirectory while sidebar.php is in the main diretory, use:

    include('../sidebar.php');
    

    It is possible to pass a url to include in php, if you enable the http file wrapper for includes in php config, but that is very much discouraged since it can cause major security problems.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line