【发布时间】:2010-07-15 05:54:24
【问题描述】:
我的代码里到处都是这样的东西
Write (thePhpFile, ' echo "<option value=\"' +
theControl.Name +
'_selection\">" . $' +
theControl.Name +
'_values[$_POST["' +
theControl.Name +
'_selection"]];');
生成以下 PHP 代码
echo "<option value=\"ComboBox1_selection\">" .
$ComboBox1_values[$_POST["ComboBox1_selection"]];?>
肯定有更好的方法来处理这个问题吗?也许是一个 Delphi 函数,我可以传递所需的 PHP 字符串并在必要时将其加倍引号?还是我自欺欺人?
基本算法似乎是
// assume all PHP strings are double quoted, even when it's inefficient
find the first double quote, if any
find the last double quote, if any
for every double quote in between
change it to \""
听起来对吗?也许我应该自己编码?
嗯,没那么容易......在上面的 sn-p 中,我们不想逃避 $_POST["ComboBox1_selection"] - 最好只是手动编码顶部显示的混乱?
有什么想法吗?我现在要去谷歌“从delphi生成php”——这可能是我几周前应该做的:-/
【问题讨论】: