Php Laravel 4数据表集成
我是Laravel的新手,我想使用Laravel datatable生成MYSQL数据,我做了如下操作: 这是用于生成数据表的html表:Php Laravel 4数据表集成,php,mysql,laravel-4,datatable,Php,Mysql,Laravel 4,Datatable,我是Laravel的新手,我想使用Laravel datatable生成MYSQL数据,我做了如下操作: 这是用于生成数据表的html表: <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-condensed table-bordered" id="articles"> <thead> <tr> <th>ID
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-condensed table-bordered" id="articles">
<thead>
<tr>
<th>ID</th>
<th>Code</th>
<th>Name</th>
<th>Description</th>
<th>Created At</th>
<th>Updated At</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
这是我的路线:
Route::group(
array('prefix' => 'arayez'),
function() {
Route::get('test', 'arayez\Test@getTest');
Route::get('getView', array('uses'=>'arayez\Test@getView','as'=>'arayezGetView'));
}
);
这就是错误:
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"syntax error, unexpected '['","file":"\/var\/www\/auth\/vendor\/bllim\/datatables\/src\/Bllim\/Datatables\/Datatables.php","line":79}}
我的代码有什么问题吗?
感谢您的帮助。查看错误消息()中的文件,您可以看到它只是一个简短的数组语法。下面是一个例子:
$array = []; // instead of $array = array();
这个错误几乎肯定意味着您的PHP版本早于5.4。解决这个问题的唯一方法是将PHP至少升级到5.4。尤其是因为它也是Laravel的一个要求(我相信是从4.1版开始的)试着检查这个文件:
\/var\/www\/auth\/vendor\/bllim\/datatables\/src\/bllim\/datatables\/datatables.php
第79行的php版本听起来比5.4版旧。php-v
的输出是什么?我将我的php版本更新到了5.4.38,但是我得到了另一个错误,比如:{“错误”:{“类型”:“Symfony\\Component\\Debug\\Exception\\FatalErrorException”,“消息”:“Class'illumb\\Support\\Arr'notfound”,“file”:“\/var\/www\/auth\/vendor\/bllim\/datatables\/src\/bllim\/datatables\/datatables\/datatables.php”,“line”:96}奇怪。尝试运行composer dump autoload
我运行了它,但我得到了相同的错误,我还应该提到一件事我的控制器结构是:controller/sub/TestController/function,你认为问题在于此吗?请运行composer update
Illumb\Support\Arr
是一个实际可用的Laravel框架类…首先运行composer dump autoload,然后运行composer update
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"syntax error, unexpected '['","file":"\/var\/www\/auth\/vendor\/bllim\/datatables\/src\/Bllim\/Datatables\/Datatables.php","line":79}}
$array = []; // instead of $array = array();