簡體   English   中英

同時在php codeigniter中包含另一個頁面,不加載父頁面

[英]while including another page in php codeigniter the parent page not loading

我正在使用codeigniter進行一個項目,所有頁面都是使用migc(codeigniter框架)完成的。 我在普通的PHP中做了幾頁並將其保存在根文件中。 如下頁:library.php database_connection.php

索引頁面是使用框架完成的,我嘗試包含library.php文件,如下所示:

 <?php // Start Session session_start(); // Application library ( with ShopingCart class ) require __DIR__ . 'library.php' $app = new ShopingCart(); $products = $app->getProducts(); ?> 

在索引頁面的頂部。

library.php如下所示:

 <?php // load database connection script include("database_connection.php"); /* * Tutorial: PHP MySQL Shopping cart * * Page: Application library * */ class ShopingCart { protected $db; function __construct() { $this->db = DB(); } 

現在的問題是當我加載索引頁面時,它甚至沒有加載顯示以下錯誤:

此頁面無法正常工作localhost目前無法處理此請求。 HTTP錯誤500

我認為它是因為我試圖在頁面中包含該文件,我怎么能擺脫這個?

Http錯誤500代表服務器錯誤。

這里有語法錯誤

require __DIR__ . 'library.php'

你忘了;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM