ckeditor echo php 变量?

发布于 2024-08-14 07:46:06 字数 609 浏览 5 评论 0原文

使用所见即所得的 CKEditor,我将以下内容存储到 MySql 中:

 <p>
Here is the information that we would like to have show</p>
<p>
&nbsp;</p>
<p>
Project:<?php echo $project; ?></p>

我需要将此内容回显为 $content 并从 _POST 数据填充 $project 变量。

然而,当我这样做时,结果如下所示:

Here is the information that we would like to have show

Project: 

在页面的源代码中,您可以看到 echo 语句,但尽管知道 $project 变量已设置并具有值,但什么也没有出现。

有人提到了 str_replace 语句并将变量写为 %project% 但它如何从 %project% 更改为

感谢您的阅读。

汤姆

Using the wysiwyg CKEditor I stored the following into MySql:

 <p>
Here is the information that we would like to have show</p>
<p>
 </p>
<p>
Project:<?php echo $project; ?></p>

I need to echo this content as $content and have the $project variable populate from _POST data.

When I do this however the result looks like this:

Here is the information that we would like to have show

Project: 

In the source for the page you can see the echo statement but nothing appears inspite of knowing that the $project variable is set and has a value.

Someone mentioned a str_replace statement and write the variable as %project% but how does it change from %project% to <?php echo $project; ?>

Thanks for reading.

Tom

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┊风居住的梦幻卍 2024-08-21 07:46:06

要执行保存在字符串中的 php,您可以使用 eval()

我也更喜欢 %project% 方法。我认为这就是它的工作原理:

echo str_replace('%project%', $project, $sql_content);

to execute php that is saved inside a string you can use eval()

i also like the %project% approach more. i think this is how it would work:

echo str_replace('%project%', $project, $sql_content);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文