简体   繁体   English

如何在codeigniter中定义Global变量?

[英]how to define Global variable in codeigniter?

I have a condition for price filtering products in codeigniter... 我有条件在Codeigniter中对产品进行价格过滤...

When user clicks on filter button, lower & higher value as well as that category id of that page is sent to controller... 当用户单击过滤器按钮时,该页面的较低和较高的值以及该类别的ID将发送到控制器...

Now, when user is on that page and clicks on another next page (In pagination).. those all values are gone... how can i set them globally so that even when user goes for next page those lower,higher value and category ids i can use again... 现在,当用户在该页面上并单击下一个页面(在分页中)时,所有这些值都消失了……我该如何全局设置它们,以便即使用户进入下一个页面时,这些较低,较高的值和类别我可以再次使用的ID ...

I am using codeigniter's pagination library... 我正在使用codeigniter的分页库...

file location - Application -> Config -> constants.php here you can define global variable 文件位置-应用程序->配置-> constants.php,您可以在此处定义全局变量

define('BASE_PATH',"/home/example/public_html/");
define('UPLOAD_PATH',BASE_PATH . 'uploads/');


//this is your global variable, can use anywhere in application
   echo $UPLOAD_PATH;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM