How to run php file with parameter using notepad++
test.php
<?php
/* -------
test.php
------- */
if(!isset($_GET['file'])){
exit;
}
$code=file_get_contents($_GET['file']);
echo $code;
?>
demo_file.php -----$(FULL_CURRENT_PATH)
contents:
hello world
cd "D:\PHPnow-1.5.6\htdocs\zc_default\my_debug_fw"<br>
"d:\PHPnow-1.5.6\php-5.2.14-Win32\php.exe" "test.php" [what here?]
how to send "demo_file.php" as $_GET['file']
to test.php ?
The console finally should output:...... hello world
When utilizing PHP from the command line the arguments aren't passed in as part of the $_GET superglobal. They're passed in as part of the $_SERVER - superglobal where $_SERVER['argc'] is the number of arguments and $_SERVER['argv'] is an array of the argument values. $_SERVER['argv'][0] is the name of the php script and $_SERVER['argv'][1] would be the first argument.
Per your example above...