我正在尝试获取私有函数内部帮助文件中定义的常量。我的助手文件在app \ Helpers \ Report \中。这是我尝试的代码。但我收到以下错误消息:
Use of undefined constant CONDITION_A - assumed 'CONDITION_A'
我做错了什么?
namespace App\Helpers\Report;
class ReportHelper
{
const CONDITION_A = "A";
const CONDITION_B = "B";
.....
}
<?php
namespace App\Http\Controllers;
use App\Helpers\Report\ReportHelper;
class MyController extends Controller
{
private function _test() {
echo ReportHelper::CONDITION_A;
}
}