Some tips for scripting in php

Source: Internet
Author: User
-The r parameter can directly execute a piece of code, no? Php, for example, php-rphpinfo (); The-R parameter can execute a piece of code for each line of the standard input. There are two variables, $ argi is the row number, and $ argn is the content of the current row. For example, ls | php-Recho $ argit $ argnn;-B and-E indicate that

-The r parameter can directly execute a piece of code, no? For example, the php-r 'phpinfo (); '-R parameter can execute a piece of code for each line of the standard input. There are two variables, $ argi is the row number, and $ argn is the content of the current row. For example, ls | php-R 'echo "$ argi/t $ argn/n"; '-B,-E indicates that

-The r parameter can directly execute a piece of code without the need For example, php-r 'phpinfo ();'

The-R parameter can execute a code segment for each line of the standard input. There are two variables, $ argi is the row number, and $ argn is the content of the current row.
For example, ls | php-R 'echo "$ argi/t $ argn/n ";'

-B and-E indicate the scripts executed at the beginning and end of the Input Processing respectively.
For example, ls | php-R 'echo "$ argi/t $ argn/n"; '-B' echo "Begin/n "; '-e' echo "End/n ";'
The result is

Begin
1 a.txt
2 B .txt
3 c.txt
...
End

For more parameters, see man php.

What are the advantages of using php in scripts? Php includes many common functions for web applications. For example, escape html and url. It is much easier to process the data.

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.