Reputation: 1001
I want to get serverUrl in model. Which class i have to import and which function i have to call in my model to get server url. So in future i can easily change my urls in http to https in configuration only. Something like this.
use Zend\View\Helper\BasePath;
abstract class MysqliDB {
protected function site_url(){
$object = new BasePath();
return $object->getView();
}
}
Please Suggest me if i can do this or there any alternative for this.
Upvotes: 1
Views: 651
Reputation: 80
You can use $_SERVER['HTTP_HOST'] for getting the host name/base url for your website.
Upvotes: 1