8
我已經在codeigniter的constants.php
文件中定義了一個變量,但是我想知道如何將該變量用於視圖文件。Codeigniter全局常量
define('UPLOAD_PATH', "/var/www/vhosts/dev/htdocs/p/");
我想在我的視圖文件中使用'UPLOAD_PATH'變量,但我不知道如何使用它。
我已經在codeigniter的constants.php
文件中定義了一個變量,但是我想知道如何將該變量用於視圖文件。Codeigniter全局常量
define('UPLOAD_PATH', "/var/www/vhosts/dev/htdocs/p/");
我想在我的視圖文件中使用'UPLOAD_PATH'變量,但我不知道如何使用它。
與在常規php中使用常量相同的方法?
echo UPLOAD_PATH; //would produce /var/www/vhosts/dev/htdocs/p/
所以在您的視圖文件:
<html>
<body>
<?=UPLOAD_PATH?>
</body>
</html>
config file (system/application/config/config.php) to set configuration related variables.
Or use
constant file (system/application/config/constants.php) to store site preference constants.
=======================
DEFINE WHAT YOU WANT
=======================
$config['index_page'] = 'home';
$config['BASEPATH'] = 'PATH TO YOUR HOST';
接受的答案! – 2011-04-25 22:38:49
你應該接受你認爲值得的答案! – SaidbakR 2013-09-08 20:49:45