This is my controller:
class Orders extends CI_Controller {
public function index() {
//get model and db entries
$this->load->model('order_model', 'orders', TRUE);
}}
When i open the corresponding url i get the content of the class php file.
class Order_model extends CI_Model {
var $fullname = ''; var $email = ''; var $address = '';
var $phone = ''; var $notes = ''; var $facebook = '';
var $canvases = ''; var $admin_notes = ''; var $status = '';
var $id = ''; var $date = '';
var $price = ''; var $emailStatus_reciveOr...
I suppose it's something small and stupid but i can't figure it out. Please help.
You are returning a string, try:
$this->load->model('order_model', 'orders');
The CodeIgniter class does document a third option for load->model
but it is for telling the model to auto-connecting to your database.
Also, you are instantiating order_model
as orders
but your controller is also called order
. I would discourage this type of naming since it can create confusing to anyone (including yourself a few weeks from now) trying to read the code.
I'm ashamed to admit it, but the error was very silly. At the model's file there was no <?php
:) so the document was a simple text as php is concern.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.