“Log Konsol di PHP” Kode Jawaban

Log Konsol PHP

// Assuming you are wishing to log to the JS Console...

<?php
	function consoleLog($msg) {
		echo '<script type="text/javascript">' .
          'console.log(' . $msg . ');</script>';
	}

	consoleLog('Hello, console!');
?>
Kaotik

console.log dalam php

/*
console.log in php
*/

<?php
	function consoleLog($message) {
		echo '<script type="text/javascript">' .
          'console.log(' . $message . ');</script>';
	}

	consoleLog('Hello, greppers!');
?>
Ankur

Log Konsol PHP

echo("<script type='text/javascript'> console.log($msg);</script>");
Ugliest Unicorn

Konsol PHP

//display message in console

<?php
	function console_log($msg) {
		echo '<script>' .
          'console.log("'.$msg .' ")</script>';
	}

	console_log("Hi there!");
?>
jp98

Log Konsol di PHP

<?php 
function console_log($object){
    echo "<script>console.log(".json_encode(var_export($object, true)).");</script>";
}
console_log('wow!');

?>
Omar

Log Konsol PHP

// A little correction / improvement to @Kaotik's answer:
<?php
	function consoleLog($msg)
	{
		echo '<script type="text/javascript">console.log('
          . str_replace('<', '\\x3C', json_encode($msg))
          . ');</script>';
	}

	consoleLog('Hello, console!');
?>
garzj

Jawaban yang mirip dengan “Log Konsol di PHP”

Pertanyaan yang mirip dengan “Log Konsol di PHP”

Lebih banyak jawaban terkait untuk “Log Konsol di PHP” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya