?

Log in

CodeIgniter question - php framework [entries|archive|friends|userinfo]
php framework

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

CodeIgniter question [окт. 19, 2007|12:28 pm]
php framework

php_framework

[xobb]
Hello guys, I need to define $conf['base_url'] dynamically based on the location of index.php file. I was trying to solve this with cutting variables from $_SERVER, but it doesn't work stable enough. Thanks in advance.
СсылкаОтветить

Comments:
From: ex_digital_4
2007-10-31 02:56 pm
echo dirname($_SERVER["REQUEST_URI"]); ?
(Ответить) (Thread)
[User Picture]From: xobb
2007-11-01 07:18 am
Thanks for your reply. I've solved the problem this way:

$proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://";

$SCRIPT_BASE_NAME = basename($_SERVER['SCRIPT_NAME']);
$host = $_SERVER['HTTP_HOST'];

$config['base_url'] = $proto.$host.str_replace($SCRIPT_BASE_NAME, '', $_SERVER['SCRIPT_NAME']);
(Ответить) (Parent) (Thread)