How to set baseUrl

2019-02-13 08:13发布

I want to set the baseurl in my project . I am using zend framework .But i am new to zend framework and i don't have any idea about how to set it? Please help. Thanks in advance

4条回答
何必那么认真
2楼-- · 2019-02-13 08:35

I think it automatically done by the zend-framework.....

try to echo............

echo $this->baseUrl();

It will give you the desired answer.......

查看更多
放荡不羁爱自由
3楼-- · 2019-02-13 08:39

One way is through Bootstrap.php:

protected function _initSetupBaseUrl() {
    $this->bootstrap('frontcontroller');
    $controller = Zend_Controller_Front::getInstance();
    $controller->setBaseUrl('/projects/myapp'); 
}

Another way is through application.ini:

resources.frontController.baseUrl = /projects/myapp
查看更多
爷的心禁止访问
4楼-- · 2019-02-13 08:47

please try this. In your abcd.phtml ( zend framework ).

 <?php echo $this->baseUrl(); ?>
查看更多
可以哭但决不认输i
5楼-- · 2019-02-13 08:57

From http://framework.zend.com/manual/en/zend.controller.request.html

$router     = new Zend_Controller_Router_Rewrite();
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('./application/controllers')
           ->setRouter($router)
           ->setBaseUrl('/projects/myapp'); // set the base url!
$response   = $controller->dispatch();
查看更多
登录 后发表回答