我在codeigniter中做一个项目,所有页面都使用mvc(codeigniter框架)完成。我已经在纯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(); }现在的问题是当我加载索引页面时,甚至没有加载显示以下错误:该页面无法正常运行localhost当前无法处理此请求。HTTP错误500我认为是因为我试图将文件包含在页面中,我如何摆脱它?
1 回答
- 1 回答
- 0 关注
- 145 浏览
添加回答
举报
0/150
提交
取消