CMD run PHP

Source: Internet
Author: User

Open a command prompt cmd.exe

E:wampbinphpphp5.2.6>php.exe a.php 11

11 is the pass parameter

Get

if ($argv [1]) {

$_get[' id ']= $argv [1];

}

echo $id =$_get[id]+1;

You can change the a.php to your file name, note the directory structure

I use a.php here directly because a.php and Php.exe are in the same directory

For convenience, you can also add the PHP installation directory to the environment variable PATH

(Right-click My Computer-> attribute-> advanced-> environment variable, if present path, add your PHP installation directory in the original path, and create a new path if it does not exist)

After adding to the environment variables, you don't have to enter the PHP installation directory in CMD to

Enter Php.exe "a.php" (note that at this point "a.php" must be in the directory where your cmd is in)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.