开发者

escaped_fragment request doesnt parse php?

开发者 https://www.devze.com 2023-03-13 23:40 出处:网络
so recently ive rebuilt my site following Google\'s AJAX Crawling methods. Everything works fine and an ?_escaped_fragment_= request works fine but i\'ve noticed any php on the page is not parsed an

so recently ive rebuilt my site following Google's AJAX Crawling methods.

Everything works fine and an ?_escaped_fragment_= request works fine but i've noticed any php on the page is not parsed and is commented out like so: <!--?php echo $myvar ?-->

Does anyone know why this may be happening?? here is some PHP from my index:

$fragment = $_GET['_escaped_fragment_'];
    $file = '' . (isset($fragment) && $fragment != '' && $fragment != '/' ? preg_开发者_如何学Goreplace('/\//', '', $fragment) : 'home') . '.html';
    $re = '/(^<[^>]*>)|(\n|\r\n|\t|\s{2,4})*/';

    $handle = fopen($file, 'r');
    if ($handle != false) {
        $content = preg_replace($re, '', fread($handle, filesize($file)));
        fclose($handle);
    } else {
        $content = 'Page not found!';
        header(php_sapi_name() == 'cgi' ? 'Status: 404' : 'HTTP/1.1 404');
    }

I noticed a regexp in there. Maybe that has something to do with it? I cant fully understand whats going on here, im no expert. Dont exactly want to put my site back up if this is gonna stay like this..

Please lend me a hand here


this was solved by creating a PHP if else statement.

0

精彩评论

暂无评论...
验证码 换一张
取 消