Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
c7898585
V2EX  ›  Linux

php 能运行 linux 代码吗

  •  
  •   c7898585 · Jul 30, 2016 · 4516 views
    This topic created in 3756 days ago, the information mentioned may be changed or developed.

    需要用 php 运行下面的代码

    sendmail -t >/dev/null 2>&1 <<EOF
    to:[email protected]
    from:[email protected] subject:我是测试 我是测试 EOF

    13 replies  •  2016-07-31 08:47:02 +08:00
    RIcter
    RIcter
    Jul 30, 2016
    1
    能
    phperstar
    phperstar
    Jul 30, 2016
    2
    弄个 sh 脚本吧,然后用 php exec 函数执行这个脚本吧
    c7898585
    c7898585
    OP
    Jul 30, 2016
    3
    @phperstar
    exec 这个函数没看懂额。。。
    skydiver
    skydiver
    Jul 30, 2016
    4
    phperstar
    phperstar
    Jul 30, 2016
    5
    @c7898585 http://php.net/manual/zh/book.exec.php 放着这么好的手册不看,太浪费呀。。。
    UnisandK
    UnisandK
    Jul 30, 2016
    6
    用 mailgun 多好
    c7898585
    c7898585
    OP
    Jul 30, 2016
    7
    @skydiver 会有代发
    90safe
    90safe
    Jul 30, 2016
    8
    shell_exec("sendmail -t >/dev/null 2>&1 <<EOF")
    exec("sendmail -t >/dev/null 2>&1 <<EOF")
    一般网站禁用 exec 函数,推荐前者。
    90safe
    90safe
    Jul 30, 2016
    9
    http://www.jb51.net/article/28241.htm
    四个执行命令的函数,不谢
    Tink
    Tink
    Jul 30, 2016
    10
    exec
    sneezry
    sneezry
    Jul 30, 2016
    11
    用 mailgun 吧,每月 10000 封免费,自己的 mail server 多数会进垃圾箱
    c7898585
    c7898585
    OP
    Jul 30, 2016
    12
    @phperstar sender 和 receiver 是变量额
    通过 PHP 传递的
    这用 sh 的话只能做定量吧
    KomeijiSatori
    KomeijiSatori
    Jul 31, 2016
    13
    system();
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4665 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 01:24 · PVG 09:24 · LAX 17:24 · JFK 20:24
    ♥ Do have faith in what you're doing.