note 124082 added to debugger

From: Date: Wed, 31 Jul 2019 12:56:01 +0000
Subject: note 124082 added to debugger
Groups: php.notes 
Request: Send a blank email to php-notes+get-211761@lists.php.net to get a copy of this message
A good example of data output to the console via <script> tags, I myself used this first, but he broke the captcha job, because <script> tags were inserted into the base64 code of the captcha picture. Then I began to display logs in the headers with such a function (it may help someone else, in a similar situation): <?php function header_log($data){ $bt = debug_backtrace(); $caller = array_shift($bt); $line = $caller['line']; $file = array_pop(explode('/', $caller['file'])); header('log_'.$file.'_'.$caller['line'].': '.json_encode($data)); } ?> Usage: $myvar = array(1,2,3); header_log( $myvar ); // in headers we see: log_filename_rownumber: [1,2,3] ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.168 (proxied: 92.242.36.181) ---- Manual Page -- http://php.net/manual/en/debugger.php Edit -- https://master.php.net/note/edit/124082 Del: integrated -- https://master.php.net/note/delete/124082/integrated Del: useless -- https://master.php.net/note/delete/124082/useless Del: bad code -- https://master.php.net/note/delete/124082/bad+code Del: spam -- https://master.php.net/note/delete/124082/spam Del: non-english -- https://master.php.net/note/delete/124082/non-english Del: in docs -- https://master.php.net/note/delete/124082/in+docs Del: other reasons-- https://master.php.net/note/delete/124082 Reject -- https://master.php.net/note/reject/124082 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#211761) next »