dump() 方法
全局 composer.json
"require": { "squizlabs/php_codesniffer": "*", "fxp/composer-asset-plugin": "^1.4", "symfony/var-dumper": "3.3.16" }
配置PHP.ini
auto_prepend_file = "C:UsersMSAppDataRoamingComposervendorautoload.php"
更新Composer
composer global update
更新后重启apache就可以全局使用函数 dump()
dd() 方法
全局 composer.json
# 新增 autoload "autoload": { "files": [ "D:/web/php/debugHelper.php" ] }
新建 debugHelper.php
# install symfony/var-dump to your project # composer require symfony/var-dumper // use namespace use ComponentVarDumperClonerVarCloner; use ComponentVarDumperDumperCliDumper; use ComponentVarDumperDumperHtmlDumper as SymfonyHtmlDumper; /** * Class HtmlDumper */ class HtmlDumper extends SymfonyHtmlDumper { /** 大专栏 PHP 全局使用 Laravel 辅助函数 ddnt"> * Colour definitions for output. * * @var array */ protected $styles = [ 'default' => 'background-color:#fff; color:#222; line-height:1.2em; font-weight:normal; font:12px Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000', 'num' => 'color:#a71d5d', 'const' => 'color:#795da3', 'str' => 'color:#df5000', 'cchr' => 'color:#222', 'note' => 'color:#a71d5d', 'ref' => 'color:#a0a0a0', 'public' => 'color:#795da3', 'protected' => 'color:#795da3', 'private' => 'color:#795da3', 'meta' => 'color:#b729d9', 'key' => 'color:#df5000', 'index' => 'color:#a71d5d', ]; } /** * Class Dumper */ class Dumper { /** * Dump a value with elegance. * * @param mixed $value * @return void */ public function dump($value) { if (class_exists(CliDumper::class)) { $dumper = 'cli' === PHP_SAPI "htmlcode">composer global dump-autoload更新后就可以全局使用函数 dd()
以上就是本次介绍的全部相关知识点,感谢大家的学习和对的支持。
标签:
PHP,Laravel,辅助函数
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“PHP全局使用Laravel辅助函数dd”评论...