从 mysql 结果打印 $variable
我有一个 mysql 二进制表,用于存储 html 电子邮件布局。在此布局中,我想放置在将调用布局的页面中填充的标签。我似乎无法让它显示除标签之外的任何内容。
示例:
从 mysql 数据库调用 ->
$sql_result = 'The property name is $prop_name.';
$message = <<<EOF
$sql_result
EOF;
当我加载页面时,它将使用 $prop_name
通过电子邮件发送结果,而不是前面在脚本中定义的实际名称。页面上的显示适用于预定义的 $prop_name
变量,但通过电子邮件发送的部分不会显示它。即使当我在同一页面上回显或打印结果时,它也只会放置 $prop_name
而不是之前定义的调用。当我从数据库调用变量时,如何让变量显示其预定义的定义?
I have a mysql binary table that I am storing html email layout. In this layout I want to put tags that are populated in the page that the layout will be called in. I can't seem to get it to display anything but the tags.
Example:
called from mysql database ->
$sql_result = 'The property name is $prop_name.';
$message = <<<EOF
$sql_result
EOF;
When I load the page it will email the result with $prop_name
instead of the actual name that is defined earlier in the scripting. The display on the page its works for the pre-defined $prop_name
variable but the emailed part does not display it. Even when I echo or print the result on the same page it will just put the $prop_name
instead of the earlier defined call. How do I get the variable to show the pre-defined defintion for it when I call it from a database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你拉“属性名称是$prop_name。”从数据库中出来,那只是纯文本。它不会用您的 $prop_name 变量更改 $prop_name 。
您应该做的只是替换文本。
因此:
这将用 $prop_name 变量的内容替换文本中的 $prop_name 锚点(如 $sql_result 变量中)。
If you pull "The property name is $prop_name." out of the database, that is just pure text. It will not change the $prop_name with your $prop_name variable.
What you should do is simply replace the text.
Thus:
This will replace the $prop_name anchor in your text (as in your $sql_result variable) with the content of your $prop_name variable.