欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-04-18 15:00:58
...
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, "/");
    }
}

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

回复内容:

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, "/");
    }
}

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

相关标签: php phpcms