简体   繁体   中英

Making Command in bash script to run php script

I've been making an email sender that's based on phpmailer . Everything is good, email sent, but i want to make my sender simpler.

When I run my script, the usual command is php MKSENDER , and I want to make it just like running from a bash script like ./MKSENDER --SEND , any suggest how to build it?

Thanks a lot

You need to look at the shebang line.

Placing #!/usr/bin/env php at the top of your file should work as long as you have execute permissions:

#!/usr/bin/env php
<?php
echo "Hello World";

You can then utilize the native function getopt() to get options, or parse argv yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM