When i wast working under cakephp 1.3 i have this method to know if i was in localhost or production server.
function isHostServer() {
$host = Configure::read('Site.host');
return (strpos($this->Session->host, $host) !== FALSE);
}
Now i have migrated to cakephp 2.x but Cookie and Session Object are not delivering my host.
Is there a solution?
In php, you are always able to look at $_SERVER array object. In cakephp just look use the env() global method for example in this case: env(‘SERVER_NAME’)
http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#env