我的代码出了什么问题?我在我的测试服务器上运行了代码并且代码工作正常但是当我将它上传到我的生产服务器时,我得到了
Parse error: syntax error, unexpected T_FUNCTION in /hermes/bosweb/web013/b130/ipg.acrsflcom/darayngedbeats/gentest.php on line 10
Run Code Online (Sandbox Code Playgroud)
这是我的代码
$old = "http://darayngedbeats1.s3.amazonaws.com /mp3/CrazyMonsta2.mp3?AWSAccessKeyId=AKIAJXA36ESCLQHCB54Q&Expires=1297279906& Signature=HD36ZQE8yeTIW6JPWKMcciPTiTs%3D"; //enter the key that needs to be converted
$search = array(":","?","=","&","%");
$replace = array("%3A","%3F","%3D","%26","%25");
function search_replace($s,$r,$sql)
{ $e = '/('.implode('|',array_map('preg_quote', $s)).')/';
$r = array_combine($s,$r);
return preg_replace_callback($e, function($v) use ($s,$r) { return $r[$v[1]]; },$sql);
}
echo "<br><br>";
$new = search_replace($search,$replace,$old);
echo $new;
?>
Run Code Online (Sandbox Code Playgroud) 我正在努力建立一个类似系统的开源信息亭.当Web浏览器启动所有程序时,它将使用PHP在浏览器中运行.我找到了这个链接:程序执行功能.它正在使用:
<?php
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("WINWORD.exe", 7, false);
?>
Run Code Online (Sandbox Code Playgroud)
我能够在Windows上启动Microsoft Word,但我需要能够在Linux上执行此操作.这是我在Linux服务器上尝试过的:
<?php
exec("/var/www/test.sh");
?>
Run Code Online (Sandbox Code Playgroud)
但没有任何反应.我知道这很test.sh有效,因为我从终端跑了.我test.sh用来启动Python脚本.Python脚本启动文本编辑器.我已经测试了Python脚本并且它可以工作.我需要知道的是如何从Linux上的PHP启动脚本.