dongmi1872 2013-07-25 21:32
浏览 43
已采纳

试图通过我的PHP脚本在我的apache服务器中执行bash命令,但是收到错误

i have just started implemting bash commands into my php scripts the first few works fine now i am trying to do the following bash command in my php script

exec("awk -F: '{printf "www.example.com/2/tks.php?account=%s%%3A%s
" ,$1, $2 }' < /opt/lampp/htdocs/$filename > /opt/lampp/htdocs/2.txt");

the error i am getting from my php script that worked fine before i put this in is

Parse error: syntax error, unexpected 'www' (T_STRING) in /opt/lampp/htdocs/index.php on line 54
  • 写回答

2条回答 默认 最新

  • dongmengan8620 2013-07-25 21:33
    关注

    You have to escape your double quotes in the string:

    exec("awk -F: '{printf \"www.example.com/2/tasks.php?account=%s%%3A%s\
    \" ,$1, $2 }' < /opt/lampp/htdocs/$filename > /opt/lampp/htdocs/2.txt");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?