In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail whether dd in laravel belongs to a function, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
In laravel, dd () belongs to the laravel helper function; the dd function is used to output a given value and end the script, printing all variables in laravel with the syntax "dd ($value1,$value2...)".
This article operating environment: Windows10 system, Laravel6 version, Dell G3 computer.
Is dd a function in laravel?
The dd function outputs the given value and ends the script running:
Dd ($value); dd ($value1, $value2, $value3,...)
The example PHP globally uses the Laravel helper function dd:
Global composer.json
"require": {"squizlabs/php_codesniffer": "*", "fxp/composer-asset-plugin": "^ 1.4", "symfony/var-dumper": "3.3.16"}
Configure PHP.ini
Auto_prepend_file = "C:UsersMSAppDataRoamingComposervendorautoload.php"
Update Composer
Composer global update
Restart apache after updating and you can use the function dump () globally.
Dd () method
Global composer.json
# add autoload "autoload": {"files": ["D:/web/php/debugHelper.php"]}
Create a new debugHelper.php
# install symfony/var-dump to your project# composer require symfony/var-dumper / / use namespaceuse ComponentVarDumperClonerVarCloner;use ComponentVarDumperDumperCliDumper;use ComponentVarDumperDumperHtmlDumper as SymfonyHtmlDumper; / * Class HtmlDumper * / class HtmlDumper extends SymfonyHtmlDumper {/ * * Big column PHP globally uses the Laravel helper function 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 ZMuiindexconst' 100000000, '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? New CliDumper: new HtmlDumper; $dumper- > dump ((new VarCloner)-> cloneVar ($value));} else {var_dump ($value);} if (! Function_exists ('dd')) {/ * Dump the passed variables and end the script. * * @ param mixed * @ return void * / function dd (. $args) {foreach ($args as $x) {(new Dumper)-> dump ($x);} die (1);}} if (! Function_exists ('dda')) {/ * Dump the passed array variables and end the script. * * @ param mixed * @ return void * / function dda (. $args) {foreach ($args as $x) {(new Dumper)-> dump ($x-> toArray ());} die (1);}} about whether dd in laravel belongs to a function or not. I hope the above can be helpful and learn more. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.