0
我的編碼是迄今爲止:如何通過系統命令在php中替換exec()?
如何通過系統命令替換exec()
在PHP?
if($str!="success")
{
$cmd = "rm -rf /portal/data/config/certificate/tmp/";
$error_text="Command : ".$cmd;
AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
$output = exec($cmd,$array1,$error_code);
$error_text="Error code : ".$error_code;
AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
seterror('0:|: :|: Could not apply certificate.');
$error_text="Could not apply certificate";
AddLog("sslconfig.php",$error_text,ERR_INFO);
header("Location: ssl.php");
exit;
}
if($certName==$cert_auth)
{
//copy the applied certificate to fireballbundle.crt
//$output = copysslfb("/portal/data/config/certificate/".$newfile.".crt");
$error_text="Selfsigned Certicate";
AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
$output="success";
}
else
{
$error_text="Not Selfsigned Certicate";
AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
$output="success";
}
if($output!="success")
{
$cmd = "rm -rf /portal/data/config/certificate/tmp/";
$error_text="Command : ".$cmd;
AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
$output = exec($cmd,$array1,$error_code);
$error_text="Error code : ".$error_code;
AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
$error_text="Could not add certificate to fireballbundle.crt : ".$output;
AddLog("sslconfig.php",$error_text,ERR_ERROR);
seterror('0:|: :|: Error in applying certificate.');
header("Location: ssl.php");
exit;
}
現在我想用系統命令替換exec命令嗎?
我使用三次exec()
這裏顯示爲上面的代碼現在我想在PHP與system()
命令替換
exec("hostname",$retval);
$output = exec($cmd,$array1,$error_code);
exec($cmd,$array1,$error_code);
:)這不是我的答 – John
:)我也在使用unlink編碼 – John