The popen function calls the local script and transmits parameters.

Source: Internet
Author: User
Boss asked me to implement a php asynchronous mail function. I found the information on the internet and found that I could use popen. so I initially wrote the following code: {code ...} this script is an account that uses phpmailer to send an email to me. Now you want to pass a parameter to this function: $ to -- recipient $ content... the boss asked me to implement a php asynchronous mail function. I found the information on the internet and found that I could use popen. so I wrote it as follows:

pclose(popen("php -f mymail.php","r"));

This script is an account that uses phpmailer to send an email to me.
Now you want to pass parameters to this function:
$ To -- recipient
$ Content -- content
$ Subject -- title.
These are essential for sending an email,
But I don't know how to write it?
Is this command followed by a parameter? As shown below, = may be a reliable point

php -f mymail.php -a $argv1 -b $argv2

Or is there something that can pass parameters? (But none of the four parameters of the popen function can be found)

Popen ("balabala", "r", $ parameter, $ parameter)

Or do you want to forcibly write it in and then use it directly? Similar to the following:

fopen("mymail.php","w");fwrite $to balabala;fwrite $subject balabala;fclose(fopen(balabala));

For php beginners, I am sorry for any issues. please kindly advise, =

Reply content:

The boss asked me to implement a php asynchronous mail function. I found the information on the internet and found that I could use popen. so I wrote it as follows:

pclose(popen("php -f mymail.php","r"));

This script is an account that uses phpmailer to send an email to me.
Now you want to pass parameters to this function:
$ To -- recipient
$ Content -- content
$ Subject -- title.
These are essential for sending an email,
But I don't know how to write it?
Is this command followed by a parameter? As shown below, = may be a reliable point

php -f mymail.php -a $argv1 -b $argv2

Or is there something that can pass parameters? (But none of the four parameters of the popen function can be found)

Popen ("balabala", "r", $ parameter, $ parameter)

Or do you want to forcibly write it in and then use it directly? Similar to the following:

fopen("mymail.php","w");fwrite $to balabala;fwrite $subject balabala;fclose(fopen(balabala));

For php beginners, I am sorry for any issues. please kindly advise, =

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.