如何在Laravel Ckeditor中包含PHP文件?
嘿,我想在我的larvel博客页面中使用CKEditor,将PHP文件包括在我的Larvel博客页面中。当我添加标签时,我有两个问题,它们会被评论,并且HTML标签仅在数据库中过滤。当我将数据库中的<?php代码或脚本直接添加到数据库中的正文时,代码仍然存在,但是<???????????php代码仍然不会解析/执行,但它会显示在博客页面中。
只要我是使用php eart()函数,我就可以从数据库中执行PHP,但是评估不是在CKEditor源代码中解析。任何解决方案都将不胜感激。 我使用larvel 5.7和ckeditor 4+
是图像 db image
博客文章 ckeditor output
ck source img 查看ckeditor源代码img
参考此处参考此处是php eval()的图片,而无需使用larvel ckeditor db img
输出IMG output img
代码到输出/参考的工作示例 '''
$servername = "";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM e.g.";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$row1 = $row['middle_name']; //would be changed to row['body'] for larvel blog
eval($row1);
}
} else {
echo "0 results";
}
$conn->close();
?>
'''
Hey I would like to include a php file into my larvel blog page using, ckeditor. I have 2 problems when I add in tags they are commented out and html tags are just filtered out in the database. When I just add the <?php code or script in the database directly to the body in database the code is still there but the <?php code still does not parse/execute but it will show up in the blog page.
I can execute php from my database as long as I am the using php eval() function, but the eval is not parsing in ckeditor source code. Any solution would be greatly appreciated.
Im using larvel 5.7 and ckeditor 4+
Here are the images
db image
blog post img
ckeditor output
ck source img
view ckeditor source code img
For reference here are pics of php eval() without using larvel ckeditor db img
output img
output img
code to output/ reference for working example
'''
$servername = "";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM e.g.";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$row1 = $row['middle_name']; //would be changed to row['body'] for larvel blog
eval($row1);
}
} else {
echo "0 results";
}
$conn->close();
?>
'''
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NVM我找到了旁路。
您可以使用html onload =“”;
您也可以在CKEditor中使用AN&lt; iframe src =“”或直接添加到数据库中以在该文件上添加PHP代码
nvm I found a bypass.
you can use an html onload="";
You can also use an <iframe src="" in the ckeditor or add directly to the database to add php code on that file