我在codeigniter中做一個項目,所有頁面都使用mvc(codeigniter框架)完成。我已經(jīng)在純PHP中完成了幾頁,并將其保存在根文件中。類似于以下頁面:library.php database_connection.php索引頁是使用框架完成的,我嘗試包括以下library.php文件:<?php// Start Sessionsession_start();// Application library ( with ShopingCart class )require __DIR__ . 'library.php'$app = new ShopingCart();$products = $app->getProducts();?>在索引頁面的頂部。library.php開始如下:<?php// load database connection scriptinclude("database_connection.php");/* * Tutorial: PHP MySQL Shopping cart * * Page: Application library * */class ShopingCart{ protected $db; function __construct() { $this->db = DB(); }現(xiàn)在的問題是當我加載索引頁面時,甚至沒有加載顯示以下錯誤:該頁面無法正常運行l(wèi)ocalhost當前無法處理此請求。HTTP錯誤500我認為是因為我試圖將文件包含在頁面中,我如何擺脫它?
- 1 回答
- 0 關注
- 157 瀏覽
添加回答
舉報
0/150
提交
取消