【发布时间】:2015-08-29 10:23:26
【问题描述】:
我目前正在使用两个 PHP 脚本; 1 将内容发布到文件,1 从两个标签之间的文件中获取内容。
发布内容脚本:
$content = $_POST["maintenancetext"];
$strNewContents = "$content";
$fileRefID = fopen("../../../maintenance.php", "w");
fwrite($fileRefID, $strNewContents);
fclose($fileRefID);
从两个标签脚本之间获取内容:
$start = '<p>';
$end = '</p>';
$string = file_get_contents("../../../maintenance.php");
$output = strstr( substr( $string, strpos( $string, $start) + strlen($start)), $end, true);
echo htmlentities($output, ENT_QUOTES);
我目前正在从文本区域发布到文件,但是我只需要在两个标签之间更改此内容。
我怎样才能做到这一点?谢谢。
【问题讨论】:
-
不清楚。现在发生了什么,你想要什么?
-
在它发布到外部文档的那一刻,我希望它发布到该外部文档中,但在两个 html 标记之间,例如
...
。并保持这些标签之外的所有内容相同。 -
fwrite($fileRefID, '<p>' . $strNewContents . '</p>');? -
删除现有内容,只在
...
标签之间发布新文本 -
阅读php.net/manual/en/…关于
mode参数
标签: php post scripting tags textarea