PHP警告[function.include]:无法打开流

时间:2011-07-29 11:39:26

标签: php include

http://smiths-heimann.az/index.php?feat=1请查看此页面。我的PHP代码看起来像那样。

<?php 
/*at the top of the page*/
if (!isset($feat)){
if (isset($_GET['page'])) 
{
    $page=$_GET['page'];
    }   
if (!isset($_GET['page']) && !isset($_GET['feat'])) 
{
    $page=1;
    }       
${'page'.$page}='class="current"';
}
    if (isset($_GET['feat']) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    }
....
/*content*/

        if(isset($page) && isset($_GET['id']) && !isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].".php";
        if(isset($page) && isset($_GET['id']) && isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].$_GET['subid'].".php";
        if(isset($page) && !isset($_GET['id']) && !isset($_GET['subid'])) 
        include "core/content/pages/".$page.".php";  /*line 136*/
        if (isset($feat) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    include "core/content/pages/featured.php";
        } 
        ?>

有什么问题?请帮忙

4 个答案:

答案 0 :(得分:1)

如果您查看了警告,则表示无法找到

Warning: include(core/content/pages/class="current".php) [function.include]: failed to open stream: No such file or directory in /home/heimann/public_html/index.php on line 136

网页..

我确信没有像class =“current”.php ....

这样的页面

小虫......我相信你可以轻易消除它

错误在于

${'page'.$page}='class="current"';

线

答案 1 :(得分:0)

更换

        if(isset($page) && isset($_GET['id']) && !isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].".php";
        if(isset($page) && isset($_GET['id']) && isset($_GET['subid']))
        include "core/content/pages/".$page.$_GET['id'].$_GET['subid'].".php";
        if(isset($page) && !isset($_GET['id']) && !isset($_GET['subid'])) 
        include "core/content/pages/".$page.".php";  /*line 136*/

使用

        if(isset($page) && isset($_GET['id']) && !isset($_GET['subid']))
        @include "core/content/pages/".$page.$_GET['id'].".php";
        if(isset($page) && isset($_GET['id']) && isset($_GET['subid']))
        @include "core/content/pages/".$page.$_GET['id'].$_GET['subid'].".php";
        if(isset($page) && !isset($_GET['id']) && !isset($_GET['subid'])) 
        @include "core/content/pages/".$page.".php";  /*line 136*/

注意

当'isset($ _ GET ['id'])'为真时......你应该确保$ page设置正确

答案 2 :(得分:0)

阅读您网站上的其他错误:

No such file or directory

路径或文件名不正确。看起来问题在于这一行:

${'page'.$page}='class="current"';

答案 3 :(得分:0)

我解决了它

代替

/*at the top of the page*/
if (!isset($feat)){
if (isset($_GET['page'])) 
{
    $page=$_GET['page'];
    }   
if (!isset($_GET['page']) && !isset($_GET['feat'])) 
{
    $page=1;
    }       
${'page'.$page}='class="current"';
}
    if (isset($_GET['feat']) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    }

if (!isset($feat)){
if (isset($_GET['page'])) 
{
    $page=$_GET['page'];
    ${'page'.$page}='class="current"';
    }   
if (!isset($_GET['page']) && !isset($_GET['feat'])) 
{
    $page=1;
    ${'page'.$page}='class="current"';
    }       

}
    if (isset($_GET['feat']) && !isset($_GET['page']))
    {
    $feat=$_GET['feat'];
    }