【发布时间】:2021-11-30 03:31:31
【问题描述】:
在 Controller 中使用多个 Trait 的问题
特征
trait A
{
public function name()
{
return 'A';
}
}
trait B
{
public function name()
{
return 'B';
}
}
trait C
{
public function name()
{
return 'C';
}
}
trait D
{
public function name()
{
return 'D';
}
}
在 CRController 中
class CRController extends Controller
{
use A {
name AS A_name;
}
use B {
name AS B_name;
}
use C {
name AS C_name;
}
use D {
name AS D_name;
}
}
错误日志
[2021-10-11 14:19:40] local.ERROR: Trait method CREATES_IS_NAME_METHOD has not been applied, because there are collisions with other trait methods on App\Http\Controllers\Panel\CRController {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 64): Trait method CREATES_IS_NAME_METHOD has not been applied, because there are collisions with other trait methods on App\\Http\\Controllers\\PNAME\\CRController at /var/www/html/app/Http/Controllers/PNAME/CRController.php:26)
[stacktrace]
#0 {main}
"}
$ php -v
PHP 7.2.24 (cli) (built: Oct 22 2019 08:28:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
执行命令...
作曲家转储自动加载
作曲家转储-自动加载-o
php 工匠配置:清除
php 工匠视图:清除
php工匠路线:清除
php 工匠缓存:清除
不知道!
【问题讨论】:
标签: php laravel laravel-5.8