编辑php文件但只显示字符串之间的数据

问题描述

美好的一天 - 我正在研究 Sugarcrm,我必须让某人访问以更改下拉值。但我不能给他管理员权限。所以 mu 下一个挑战将是编辑保存下拉信息的 PHP 文件。我试过 fgets 等。

代码如下

<html>
<body>
<?PHP
ini_set('display_errors','On');
error_reporting(E_ALL);


$filename = "/var/www/html/site/custom/include/language/lang.en_us_test.lists.PHP";
$fd = fopen($filename,"r");
$textFileContents = fread($fd,filesize($filename));
fclose($fd);

echo "$textFileContents";

$writedata = $_GET['newdata'];

if ($_POST['frmSub']) {
$fd=fopen("/var/www/html/site/custom/include/language/lang.en_us_test.lists.PHP","w");
fwrite($fd,$writedata);
fclose($fd);
}
?>


<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="POST" >

<textarea name="newdata" rows="10" cols="40">
<?
echo stripslashes($textFileContents);
?>
</textarea>

<input type="submit" name="frmSub" value="submit">
</form>

</body>
</html>

数据看起来像这样 - 我只想从 farmer_drop 开始读取。前面没有任何数据。

farmer_drop
    SIRKEL N LANDGOED: SIRKEL N LANDGOED
    "CPJ PRIDE ": "CPJ PRIDE "
    WJ BOTHA BOERDERY: WJ BOTHA BOERDERY
    KOPPIE BOERDERY: KOPPIE BOERDERY
    MM AARTAPPELS: MM AARTAPPELS
    HALLS: HALLS
    RAMBURG AGRO: RAMBURG AGRO
    CLEARWATER: CLEARWATER
    JH NEL: JH NEL
    UITDRAAI BOERDERY: UITDRAAI BOERDERY
    RHEEDERS BOERDERY: RHEEDERS BOERDERY
    BARLOW: BARLOW

但我返回so_stage_dom @clear @orig Ordered Preperation: Preperation @orig In Manufacturing @orig Partially Shipped and Invoiced @orig Partially Shipped and not Invoiced @orig Shipped and not Invoiced @orig Closed - Shipped and Invoiced 查询查询payment_type_dom 检查:检查电汇:EFT case_category_dom @clear Fresh:新鲜处理:已处理 客户投诉:客户投诉 case_type_dom @clear 客户返回:客户返回 客户投诉:客户投诉 IWT 行状态 no_more_rows:没有更多行 sage_sync none:不同步到:QBIS 到 SageOne 从:SageOne 到 QBIS 两者:双向同步 bank_type Cash:现金支票:"""Cheque """ Credit Card:信用卡 EFT:EFT 思科路由器类型 A 型:A 型 B 型:B 型quote_pricing_type_dom 按重量:按重量 按数量 项目:按数量 项目 按数量:按数量 line_type_dom 无:无 Invoice_Only:仅发票 瓶 20L:瓶 20L 切块:切块 FROZEN:切块 FROZEN 切片:切片 板条箱:板条箱预包装: N ormal: normal Cut: Cut Washed: Washed Grated: Grad Rings: Rings Ripe Ripe: Ripe Whole: Whole Roundel: Roundel Fresh: Fresh S/Cut: S/Cut L/Cut: L/Cut C/Cut: C/Cut F/切割:F/Cut Top_&_Tail:顶部和尾部 粉碎:压碎 煮熟:煮熟 去皮:去皮 1/2_Cut:1/2 Cut 1/4_Cut:1/4 Cut Cut_with_Stalks:用茎切割 Cut_no_Stalks:不切割 清洁:清洁 Chips_6mm:芯片 6mm Chips_10mm:芯片 10mm Chips_12mm:芯片 12mm Wedges_no_Skin:我们

也出现错误

注意:未定义索引:第 15 行 /var/www/html/Ebbulfoods/custom/qscripts/farmer/farmer.PHP 中的新数据

注意:未定义索引:第 17 行 /var/www/html/Ebbulfoods/custom/qscripts/farmer/farmer.PHP 中的 frmSub

请帮忙

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)