调用未定义函数App\Utils xec()

问题描述 投票:0回答:1

当我单击系统中的页面时,出现此错误

Call to undefined function App\Utils\exec()

如何解决?

laravel exec
1个回答
0
投票

**您收到错误“exec() is undefined”,因为 Utils 类中没有 exec 方法。而exec方法实际上是在“Illuminate\Support\Facades\Process”类中找到的;因此,您必须在 App\Utils 中导入此类。将以下代码写入您的 App\Utils 代码的顶部:**

use Illuminate\Support\Facades\Process;

此更改后,您的代码必须有效:

Process::exec('which php');

© www.soinside.com 2019 - 2024. All rights reserved.