php – Composer:指定autoload_files需要订单
发布时间:2020-12-13 13:22:06 所属栏目:PHP教程 来源:网络整理
导读:Laravel的辅助函数具有if(!function_exists(‘xx’))保护. 我可以指定autoload_files的顺序,并且在helpers.php之前让Kint.class.php需要吗? return array( $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',$vendorDir . '/raveren/
Laravel的辅助函数具有if(!function_exists(‘xx’))保护.
我可以指定autoload_files的顺序,并且在helpers.php之前让Kint.class.php需要吗? return array( $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',$vendorDir . '/raveren/kint/Kint.class.php',);
我通过几种方式对此进行了测试,通过在自动加载中添加我的助手以及我们首先加载的Laravel助手.
所以我的解决方案是在供应商自动加载之前包含您自己的帮助程序功能. 我在公共文件夹上的index.php文件中完成了它 //my extra line require_once __DIR__.'/../app/helpers.php'; //this is laravel original code //I make sure to include before this line require __DIR__.'/../vendor/autoload.php'; 在你的帮助文件中,你可以定义你的帮助函数: function camel_case($value) { return 'MY_OWN_CAMEL_CASE'; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |