簡體   English   中英

我將如何創建一個php腳本來執行shell命令以將文本寫入另一個php文件?

[英]How would I go about creating a php script to execute a shell command to write text to another php file?

我將如何創建一個php腳本來執行shell命令以將文本寫入另一個php文件? 並沒有任何須藤問題。 到目前為止,我已經知道了。

<?php
include("inc/config.php");
$command = "sed -i '$ a\this is line 2 without redirection' admin.php";
$command1 = "cat admin.php";
$output = shell_exec($command);
$output1 = shell_exec($command1);
echo "<pre>$output</pre>";
echo "<pre>$output1</pre>";
?>

我用chown wwwdata和chmod 777

您的腳本需要在有權執行您需要做的所有事情的帳戶下運行。 就這么簡單。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM