小编kja*_*mes的帖子

Laravel更新后的用户模型错误(类用户包含3个抽象方法)

在使用composer update更新我的laravel后,我得到了这个

"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException",
"message":"Class User contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (Illuminate\\Auth\\UserInterface::setRememberToken, Illuminate\\Auth\\UserInterface::getRememberTokenName, Illuminate\\Auth\\Reminders\\RemindableInterface::getReminderEmail)",
"file":"D:\app\\models\\User.php",
"line":54
Run Code Online (Sandbox Code Playgroud)

验证时出错.

php laravel laravel-4

22
推荐指数
1
解决办法
8375
查看次数

排序在 laravel http 响应中不起作用

当我尝试执行asort($data)然后返回它时response()->json($data, 200),输出仍处于原始位置。

这是代码:

$fruits = array( 'guava', 'apple', 'orange' );
asort( $fruits );
return response()->json( $fruits, 200 );
Run Code Online (Sandbox Code Playgroud)

那么输出仍处于其位置。

{
  0: "guava",
  1: "apple",
  2: "orange"
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试在排序发生后转储数据时,就像

$fruits = array( 'guava', 'apple', 'orange' );
asort( $fruits );
dd( $fruits );
Run Code Online (Sandbox Code Playgroud)

我得到了正确的数据位置。

array:3 [
  1 => "apple"
  0 => "guava"
  2 => "orange"
]
Run Code Online (Sandbox Code Playgroud)

知道吗,为什么会发生这种情况?我该如何解决这个问题?我使用Laravel 5.1

php sorting laravel-5

5
推荐指数
1
解决办法
3077
查看次数

标签 统计

php ×2

laravel ×1

laravel-4 ×1

laravel-5 ×1

sorting ×1