V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
c7898585
V2EX  ›  Linux

php 能运行 linux 代码吗

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