首先我想说我已经阅读并尝试了所有其他问题,但是我仍然得到相同的错误500。
我有XAMPP本地,一切正常,问题是我将网站上传到我的网站主页。
索引在公共文件夹中并且工作正常,但是当我尝试去/ finder时我获得了500页
这是我文件的结构:
public/index.php its ok
app/views/finder.php 500 error
这是我的路线档案:
Route::get('/', function()
{
return View::make('index');
});
Route::get('finder', 'ApartmentsController@finder');
这是我的htaccess
选项-MultiViews
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
任何建议?
提前感谢。
更新:
问题不在于htaccess,问题出在方法finder()中,正好在查询构建器中,但为什么它在本地工作???:
$searchResult=DB::table('books')->join('apartments', 'apartment_id', '=', 'apartments.id');
if(((count($tipo)==NULL)||(count($tipo)==1)) && $tipo[0]==''){
}else if (count($tipo)==1){
$searchResult->where('apt_type','=',$tipo[0]);
}else{
$searchResult->where(function($query){
//Here is the problem, if I delete this piece of code everything works $query->where('apt_type','=',Input::get( 'tipo' )[0]);
for ($i=1;$i<count(Input::get( 'tipo' ));$i++){
$query->orwhere('apt_type','=',Input::get( 'tipo' )[$i]);
}
});
}
答案 0 :(得分:1)
语法Input::get( 'tipo' )[$i]
仅适用于PHP 5.4+。如果您的主机是PHP 5.3,它将无法正常工作。
http://php.net/manual/en/migration54.new-features.php
添加了函数数组解除引用,例如 FOO()[0]