在Laravel 6.0中
我想在VirtualTime.php中加载“ virtual_time.txt”文件,该文件将自动加载。
public static function loadingTimeConfig()
{
$timeConfigFile = storage_path('app/virtual_time.txt');
}
但是当我调用此函数时,会出现错误
<br />
<b>Fatal error</b>: Uncaught ReflectionException: Class path.storage does not exist in
D:\supc\test_server\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php:804
Stack trace:
#0 D:\supc\test_server\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(804):
ReflectionClass->__construct('path.storage')
#1 D:\supc\test_server\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(682):
Illuminate\Container\Container->build('path.storage')
#2 D:\supc\test_server\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(630):
Illuminate\Container\Container->resolve('path.storage', Array)
#3 D:\supc\test_server\laravel\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php(121):
Illuminate\Container\Container->make('path.storage', Array)
#4 D:\supc\test_server\laravel\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php(846):
app('path.storage')
#5 D:\supc\test_server\laravel\app\Http\Helpers\Preload\VirtualTime.php(17): stora in
<b>D:\supc\test_server\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php</b> on line
<b>806</b><br />
我确保在加载VirtualTime.php之前先加载辅助程序。
autoload_static.php
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
'538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php',
'9cdd7b9056abc3081735233ba9dd9c7f' => __DIR__ . '/..' . '/facade/flare-client-php/src/helpers.php',
'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
'58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php',
'b6ec61354e97f32c0ae683041c78392a' => __DIR__ . '/..' . '/scrivo/highlight.php/HighlightUtilities/functions.php',
'ed962a97bd972bc82007176b647d4e36' => __DIR__ . '/..' . '/facade/ignition/src/helpers.php',
'53b704d8874a8ae7c29ecda1579dd0ba' => __DIR__ . '/../..' . '/app/Http/Helpers/Preload/Const.php',
'674dafb1921ec2adbf0ffe278928c9f8' => __DIR__ . '/../..' . '/app/Http/Helpers/Preload/VirtualTime.php',
);
在这种情况下如何使用storage_path方法?