I have these 2 constants defined:

define( 'SITE_ROOT',$_SERVER['DOCUMENT_ROOT'] . '/' );

define( 'APP_ROOT', str_replace('\\', '/', dirname(dirname(__FILE__))) . '/' );

My folder structure is like this:

Site_Root (exampledomain.com)
   - docs
   - tests
   - app
      - assets
      - libs
      - core

If I use something like :

$appassets = APP_ROOT.'assets/css/'.$filename.'.css';

it echos the path as:

http://exampledomain.com/var/www/app/assets/css/core.css

How can I get rid of this var/www/ bit from the echoed path?

I want the value of 'SITE_ROOT' to be 'http://exampledomain.com/'

and the value of 'APP_ROOT' to be 'http://exampledomain.com/app/'

How can I achieve this?

有帮助吗?

解决方案

define( 'APP_ROOT', '/app/');

if you really need a constant for this

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top