如何使用Codeigniter创建购物车类? [英] How Do I Create Cart Class Using Codeigniter?

查看:94
本文介绍了如何使用Codeigniter创建购物车类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从网上下载了codeigniter文件,我在wamp服务器中提取了文件。我将其重命名为Shoppingme。



我进入应用程序配置文件

并更改代码?



i have download the codeigniter file from the web and i extracted the file inside wamp server. i renamed it as Shoppingme.

and i went inside application config file
and change the code?

$config['base_url']	= "http://localhost/Shoppingme/";







$config['index_page'] = "";





我也改变了应用程序文件夹中的autoload.php。





and i change the autoload.php inside application folder as well.

$autoload['libraries'] = array('database','cart');







$autoload['helper'] = array('form','html','url');





还没有创建数据库?.......



我在控制器文件夹中开发了一个名为'shopMe'的php文件。 />






didn't create the database yet?.......

and i developed a php file called 'shopMe' inside controller folder.


<?php
class shopMe extends Controller {
    
    function add() {
        $data = array('id'=>'42', 'name'=>'Pants','qty'=>1,'price'=>19.99,
        'options'=>array('Size'=>'medium'));
        
        $this->cart->insert($data);
        echo "add() called";
    }
}
?>





i保存代码

和我输入http:// localhost / Shoppingme / shopMe /在浏览器中添加

它给了我这个错误



未找到



在此服务器上找不到请求的URL / Shoppingme / shopMe / add。



但应该在浏览器中显示答案,例如

add()调用..



我能为此做些什么?



i save the code
and i typed http://localhost/Shoppingme/shopMe/add inside browser and
it gives me this error

Not Found

The requested URL /Shoppingme/shopMe/add was not found on this server.

but answer should be showed in the browser like
add() called..

what i can do for this?

推荐答案

config [' base_url'] = http:// localhost / Shoppingme /;
config['base_url'] = "http://localhost/Shoppingme/";








config [' index_page'] = ;
config['index_page'] = "";





我也改变了应用程序文件夹中的autoload.php。





and i change the autoload.php inside application folder as well.


autoload [' libraries'] = array(' database'' cart');
autoload['libraries'] = array('database','cart');








这篇关于如何使用Codeigniter创建购物车类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆