1
所有頁面都通過索引頁面進行解析,但是如果通過索引頁面解析頁面,則PHP代碼不會被解析。並在頁面源代碼中顯示所有的php代碼。我使用.htaccess文件,代碼如下:重定向頁面在php中無法正常工作?
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.org [NC]
RewriteRule ^(.*)$ http://www.domain.org/$1 [R=301,NC]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /index.php/$1 [R,L]
Order allow,deny
Allow from all
<Files 403.shtml>
order allow,deny
allow from all
</Files>
從索引頁中的函數獲取所有文件內容。功能是:
public function getPageContent()
{
$html = implode('', file($this->_ROOT.$this->getPage()));
echo $html;
}
所以你不想重定向PHP文件? – 2013-05-07 07:01:50
遐我想重定向php文件,但重定向文件中的php coeds未被解析。例如,如果home.php頁面被重定向到index.php頁面,但home.php頁面中的代碼未被解析。 – Banshi 2013-05-07 07:04:07
你在做什麼index.php?你包括(「」)'home.php? – 2013-05-07 07:06:00