php 能运行 linux 代码吗

2016 年 7 月 30 日
 c7898585

需要用 php 运行下面的代码

sendmail -t >/dev/null 2>&1 <<EOF
to:receiver@exmaple.com
from:sender@example.com subject:我是测试 我是测试 EOF

3994 次点击
所在节点    Linux
13 条回复
RIcter
2016 年 7 月 30 日
phperstar
2016 年 7 月 30 日
弄个 sh 脚本吧,然后用 php exec 函数执行这个脚本吧
c7898585
2016 年 7 月 30 日
@phperstar
exec 这个函数没看懂额。。。
skydiver
2016 年 7 月 30 日
phperstar
2016 年 7 月 30 日
@c7898585 http://php.net/manual/zh/book.exec.php 放着这么好的手册不看,太浪费呀。。。
UnisandK
2016 年 7 月 30 日
用 mailgun 多好
c7898585
2016 年 7 月 30 日
@skydiver 会有代发
90safe
2016 年 7 月 30 日
shell_exec("sendmail -t >/dev/null 2>&1 <<EOF")
exec("sendmail -t >/dev/null 2>&1 <<EOF")
一般网站禁用 exec 函数,推荐前者。
90safe
2016 年 7 月 30 日
http://www.jb51.net/article/28241.htm
四个执行命令的函数,不谢
Tink
2016 年 7 月 30 日
exec
sneezry
2016 年 7 月 30 日
用 mailgun 吧,每月 10000 封免费,自己的 mail server 多数会进垃圾箱
c7898585
2016 年 7 月 30 日
@phperstar sender 和 receiver 是变量额
通过 PHP 传递的
这用 sh 的话只能做定量吧
KomeijiSatori
2016 年 7 月 31 日
system();

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://study.congcong.us/t/295968

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX