2012-02-26 73 views
0

我把這些代碼放在我的主題文件「index.php」中 我的php版本是5.3.8 已經把.htaccess文件夾裝到wordpress文件夾和options-permalink關閉了。如何讓wordpress使用苗條框架?

的.htaccess

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php [QSA,L] 

的index.php

<?php get_header(); ?> 
<?php 
$app = new Slim(); 
$app->get('/', function ($test) { 
    echo "hello"; 
}); 
$app->run(); 
?> 
<?php get_footer(); ?> 

我運行這段代碼,頁面是空白 和鉻控制檯顯示505錯誤

+0

什麼是結合兩者的目的是什麼?另外,當涉及到路線和路線處理時,會不會有顧慮? – therons 2013-03-30 03:01:42

+0

也許做一些backbone.js或ajax調用? – 2013-06-13 00:32:44

回答

1

嘗試移動get_header()get_footer()調用app-> get函數。所以,你的index.php文件應該是這樣的......

<?php 
require "Slim/Slim.php"; 
$app = new Slim(); 

$app->get('/', function() {  
    get_header(); 
    echo "hello"; 
    get_footer(); 
}); 

$app->run(); 
?>