在webroot文件中读取Config变量

In my application,I already set a variable like config in core.php such as

core.php

$websetting = array(
    'mydomain' => $_SERVER['HTTP_HOST'],
    'adminEmail' => 'admin@xyz.com',
    'supportEmail' => 'support@xyz.com',
    'infoEmail' => 'info@xyz.com',
    'accountEmail' => 'accounts@xyz.com',
    'facebook' => 'facebook.com/xyz',
    'twitter' => 'twitter.com/@xyz'
);

Configure::write('WebsiteSetting', $websetting);

Now I create a one morning.php file in cj in webroot. So my path is like: webroot/cj/morning.php

In morning.php I try to read Configure::read('WebsiteSetting.mydomain').

<?php
echo Configure::read('WebsiteSetting.mydomain');
?>

What happened :

In your controller set a variable to your view...

Controller:

$this->set('mydomain', Configure::read('WebsiteSetting.mydomain'));

View:

echo $mydomain;

If it is used in a layout set the variable from beforeFilter or beforeRender

Why would you do that? The morning.php file in your webroot has absolutely no information about cake. You would need to copy the index.php and modify it (remove the dispatching) so that all the cake stuff is included before trying to use cake functionality like Configure..

What exactly are you trying to achieve? Use the normal controller/action stuff to create your page - no matter what context it is.