2011-04-28 20:16



I need to include a php file to one of my file.

I have a php file like

I need to include another php file from this directory

I wrote this code inside that index.php page


But it's not working. :( It says Warning: include(..\downloads/apple_count.php) [function.include]: failed to open stream: No such file or directory.....

Please help me to do this :(

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dselp3944 dselp3944 10年前

    php on windows or linux?

    if you are constantly including out of the same file you could use


    either way you need to flip that ..\ into a ../

    点赞 评论 复制链接分享
  • doulun1666 doulun1666 10年前

    The path you specific is relative to the current work direcotry, not the directory from where you call it, and its not resolved against the include path. Try absolute pathes

    include(dirname(__FILE__) . '/../downloads/apple_count.php');

    Paths starting with / are absolute, starting with . oder .. are relative against the current work directory and everything else is resolved against the include-path.

    点赞 评论 复制链接分享
  • doutian4046 doutian4046 10年前

    Are you using rewriting? Did you try include('/downloads/apple_count.php');

    点赞 评论 复制链接分享
  • doulan8152 doulan8152 8年前


    点赞 评论 复制链接分享