Php 从数据库重新加载内容并将新行格式化为</br>;内码点火器

Php 从数据库重新加载内容并将新行格式化为</br>;内码点火器,php,sql,codeigniter,Php,Sql,Codeigniter,下面是我的控制器: <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Site extends CI_Controller { public function __construct() { parent::__construct(); $this->err_msg_model = $this->config->item('err_msg_model

下面是我的控制器:

<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Site extends CI_Controller {

public function __construct() {
    parent::__construct();
    $this->err_msg_model = $this->config->item('err_msg_model');
    $this->err_code = $this->config->item('err_code_model');
    $this->err_code_success = $this->config->item('err_code_success');
    $this->default_reset_pass = $this->config->item('password_default_reset');
    $this->load->helper('form');
}

public function index() {
    $this->load->model('site_model', '', TRUE);
    $this->load->library('pagination');
    $this->load->library('table');

    $limit = 10;

    if ($this->uri->segment(3) === null) {
        $offset = 0;
    } else {
        $offset = $this->uri->segment(3);
    }

    $config['base_url'] = 'http://localhost/gundaling/site/index/';
    $config['total_rows'] = $this->db->get('data')->num_rows();
    $config['per_page'] = $limit;
    $config['num_links'] = 20;

    $queryz = $this->site_model->reportpage2($offset, $limit);
    $result = @json_decode($queryz);
    $code7 = "";
    if ($result != "") {
        $code7 = $result->code;
        $message = $result->message;
        $data['result_select_survey'] = "-";
    } else {
        $data['result_select_survey'] = "";
    }

    if ($queryz->num_rows() > 0) {
        $cupu = $queryz->row();
        $test = $cupu->id;
        echo $test;
        echo "good :)";
    } else {
        echo "bad :(";
    }

    $this->pagination->initialize($config);
    $data['records2'] = $queryz;

    $this->load->view('template-web/vhead');
    $this->load->view('template-web/vheader');
    $this->load->view('template-web/site_view', $data);
    $this->load->view('template-web/vfooter');
}

}
标题和内容正在使用换行符! 甚至,当我从phpmyadmin检查元素时,它给了我:
Hadirilah Kajian婚礼系列6
“Karamnya Sebuah Kapal”

那么我的剧本有什么问题?请帮忙(

您应该使用函数,如下所示:

echo "<p>".$row->id . " : ". $row-> title . " - ". nl2br($row->content)."</p>";
echo“”$row->id.:“$row->title.-”.nl2br($row->content)。“

”;
<div class="c-layout-page">
<!-- BEGIN: PAGE CONTENT -->
<div id="container">
    <h1>Super Pagination with Code Igniter</h1>
    <?php foreach($records2->result() as $row){
        echo "<p>".$row->id . " : ". 
             $row-> title . " - ". $row->content."</p>";
    } 

    ?>
    <?php echo $this->pagination->create_links(); ?>
</div>

</div>
 |id  | title                            | content
 |1   | Hadirilah                        | Bismillahirrohmanirrohim
 |    | Kajian Wedding Series #6         | Assalamu`allaikum 
 |    | "Karamnya Sebuah Kapal"          | warohmatullahi wabarokatuh
echo "<p>".$row->id . " : ". $row-> title . " - ". nl2br($row->content)."</p>";