V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
c7898585
V2EX  ›  Linux

php 能运行 linux 代码吗

  •  
  •   c7898585 · 2016-07-30 11:32:06 +08:00 · 3110 次点击
    这是一个创建于 2799 天前的主题,其中的信息可能已经有所发展或是发生改变。

    需要用 php 运行下面的代码

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

    13 条回复    2016-07-31 08:47:02 +08:00
    RIcter
        1
    RIcter  
       2016-07-30 11:36:16 +08:00
    phperstar
        2
    phperstar  
       2016-07-30 11:36:22 +08:00
    弄个 sh 脚本吧,然后用 php exec 函数执行这个脚本吧
    c7898585
        3
    c7898585  
    OP
       2016-07-30 11:50:55 +08:00
    @phperstar
    exec 这个函数没看懂额。。。
    skydiver
        4
    skydiver  
       2016-07-30 11:52:24 +08:00
    phperstar
        5
    phperstar  
       2016-07-30 11:54:10 +08:00
    @c7898585 http://php.net/manual/zh/book.exec.php 放着这么好的手册不看,太浪费呀。。。
    UnisandK
        6
    UnisandK  
       2016-07-30 11:55:21 +08:00
    用 mailgun 多好
    c7898585
        7
    c7898585  
    OP
       2016-07-30 12:00:30 +08:00
    @skydiver 会有代发
    90safe
        8
    90safe  
       2016-07-30 12:18:52 +08:00
    shell_exec("sendmail -t >/dev/null 2>&1 <<EOF")
    exec("sendmail -t >/dev/null 2>&1 <<EOF")
    一般网站禁用 exec 函数,推荐前者。
    90safe
        9
    90safe  
       2016-07-30 12:20:57 +08:00
    http://www.jb51.net/article/28241.htm
    四个执行命令的函数,不谢
    Tink
        10
    Tink  
       2016-07-30 12:26:59 +08:00
    exec
    sneezry
        11
    sneezry  
       2016-07-30 12:31:54 +08:00
    用 mailgun 吧,每月 10000 封免费,自己的 mail server 多数会进垃圾箱
    c7898585
        12
    c7898585  
    OP
       2016-07-30 14:58:03 +08:00
    @phperstar sender 和 receiver 是变量额
    通过 PHP 传递的
    这用 sh 的话只能做定量吧
    KomeijiSatori
        13
    KomeijiSatori  
       2016-07-31 08:47:02 +08:00
    system();
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2796 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:50 · PVG 19:50 · LAX 04:50 · JFK 07:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.