我做了很多搜索我的问题,但我没有得到任何东西..
在codeigniter中,当我使用配置文件时,我这样做:
my_config.php:
$config['my_title'] = ' My Title Here ' ;
$config['color'] = ' red ' ;
Run Code Online (Sandbox Code Playgroud)
我可以像这样检索它:
$this->load->config('my_config', TRUE );
$data['my_title'] = $this->config->item('my_title', 'my_config');
Run Code Online (Sandbox Code Playgroud)
我的问题是:如何获得完整的数组来处理它?
我希望$ config作为一个数组来做这样的事情:
foreach($config as $key=>$val){
$data[$key] = $val ;
}
Run Code Online (Sandbox Code Playgroud)
所以我不必在配置文件中写下我的所有变量,如下所示:
$data['my_title'] = $this->config->item('my_title', 'my_config');
$data['color'] = $this->config->item('color', 'my_config');
Run Code Online (Sandbox Code Playgroud)
等等 ..
抱歉我的英语不好!
提前致谢 ;)
我使用Codeigniter框架,你知道当我尝试加载配置文件然后使用它
我这样做:
$this->load->config('myconfig', TRUE);
Run Code Online (Sandbox Code Playgroud)
myconfig.php文件位于应用程序文件夹(application/config/myconfig.php)中
并像这样使用它:
$this->config->item('get_item', 'myconfig')
Run Code Online (Sandbox Code Playgroud)
我的问题是:如何更改myconfig文件的位置并正确使用它?
我想将配置文件放在out文件夹中,如下所示:
我需要做这样的事情:
$this->load->config(base_url.'myConfigFiles/myconfig', TRUE);
Run Code Online (Sandbox Code Playgroud)
任何帮助?
我的数据库上有3个表:
id ------- username
1 user1
2 user2
Run Code Online (Sandbox Code Playgroud)
id ------- name
4 writer4
5 writer5
8 writer8
Run Code Online (Sandbox Code Playgroud)
user_id ----- follow
1 5
1 8
2 5
Run Code Online (Sandbox Code Playgroud)
所以,现在User1跟随writer5和writer8,user2跟随writer5
我以user1身份登录我的应用程序,当我进入编写器页面时,我获得了数据库中所有编写者的列表.我只想在每位作者面前展示我是否关注这位作家.
列表编写者页面示例:
writer4 :follow
writer5 :unfollow (i'm following him now)
writer8 :unfollow (i'm following him now)
writer100 :follow
Run Code Online (Sandbox Code Playgroud)
我的问题是:如果我不是(作为user1)跟随此作者,是否有查询获取完整的编写者列表并给我一个值= 0
有任何想法吗 ?谢谢 ..