php代码
$shellCommand = "sh 路径.sh 第一个参数 第二个参数“;
$res = exec($shellCommand);
shell 脚本
#!/bin/bash
file=$1 #第一个参数
upload_ip=$2 #第二个参数
F="sendftp"
User="user ftp账户"
Pwd="ftp密码"
echo "open $upload_ip" > ${F}
echo "$User $Pwd" >> ${F}
echo "binary" >> ${F}
echo "put 路径+$file" >> ${F}
echo "bye" >> ${F}
/usr/bin/ftp -i -n < ${F}
网友评论