首页 >后端开发 >php教程 >phpcms中index.php中这段代码有何意义?

phpcms中index.php中这段代码有何意义?

WBOY
WBOY原创
2016-08-08 09:06:561063浏览

<code>if (strpos($_SERVER["REQUEST_URI"], "/CHA")===0 ) {
    $end = strpos($_SERVER["REQUEST_URI"], "/", 1);
    $channel = substr($_SERVER["REQUEST_URI"], 1, $end-1);
    $channelConfig = pc_base::load_config('channel');
    if ( !empty($channel) && isset($channelConfig[$channel]) ) {
        setcookie("channel", $channel, time()+7*86400, "/");
    }
}

</code>

phpcms中index.php里的这段代码我懂代码意思,但是不知道这样有何意义,是不是phpcms里面一般都这样?

回复内容:

<code>if (strpos($_SERVER["REQUEST_URI"], "/CHA")===0 ) {
    $end = strpos($_SERVER["REQUEST_URI"], "/", 1);
    $channel = substr($_SERVER["REQUEST_URI"], 1, $end-1);
    $channelConfig = pc_base::load_config('channel');
    if ( !empty($channel) && isset($channelConfig[$channel]) ) {
        setcookie("channel", $channel, time()+7*86400, "/");
    }
}

</code>

phpcms中index.php里的这段代码我懂代码意思,但是不知道这样有何意义,是不是phpcms里面一般都这样?

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn