gpt4 book ai didi

php - 如何在 CodeIgniter 中将 HTML、PHP 内容插入数据库

转载 作者:搜寻专家 更新时间:2023-10-30 22:07:14 24 4
gpt4 key购买 nike

我想将我的 PHP 返回的 HTML 代码存储到 MySQL 数据库中。我已经手动插入到数据库中。但是当我从数据库中获取该数据时,它显示错误并且 PHP 代码没有解码。

例如:$title 有值但它显示 $title。

错误:

我的 Controller :

$url_data=$this->capcee_news->get_site_details($default_url);
$data['title']=$url_data['vchr_paper_name'];
$data['header']=$url_data['part1'];
$this->load->view('blank',$data);

我的模型:

public function get_site_details($url='')
{
if(!empty($url)){
$this->db->select('*');
$this->db->from($this->tables['papers']);
$this->db->join('tbl_template','tbl_news_paper.theme_id=tbl_template.pk_int_temp_id');
$this->db->where('site_url',$url);
$data=$this->db->get()->row_array();
return $data;}
return false;
}

我的看法:

echo $header;

数据库内容:

<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?=$title;?></title>
<meta name="description" content="">

最佳答案

你能使用实际的 php 标签吗,比如

<?php echo $title; ?>

您还可以发布更多代码示例吗?

关于php - 如何在 CodeIgniter 中将 HTML、PHP 内容插入数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47924317/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com