Is there a problem about the current path of ZF? Please help. Thanks

Source: Internet
Author: User
What is the current path of ZF? Please help. Thank you! I have encountered a problem after studying zendframework for a while. I hope you guys can help solve this problem. thank you for working on the background, adminControll. php access is http: // URL/admin. I read this sentence in many places, including tutorials and so on. what is the current path of $ this ZF? Please help. Thank you.
The younger brother has just studied zendframework for a while and encountered a problem. I hope you can help us solve this problem. thank you first.
In my background, adminControll. php
Access is http: // URL/admin
I have read many articles, including tutorials, and so on. I wrote this sentence during initialization,
$ This-> view-> baseUrl = $ this-> _ request-> getBaseUrl ();
But I read the output, but it's just.
In addition, it does not play any role at all. I usually use $ this-> baseUrl in front of many links, but there is always an error when opening the page, that is, the correct link address is not obtained, up to now I can only write dead, such as the URL is http://www.123.com, now to see a articleAction. So I will die on the page, http://www.123.com/admin/article
If I change to $ this-> baseUrl. "/admin/article", an error may occur. for example, when I connect parameters to a single page, an error occurs at http://www.123.com/admin/article/act/edit/id/1. In this case, the obtained path is very bad.
Maybe I am confused, but I don't know if you can understand it?
My style may be affected by this path problem. Unless the path is written to death.
Use
Displayed correctly.
And on the http://www.123.com/admin/article/act/edit/id/1 page, there is an error. However, they call the same file with the same address path. in the Web site, there are many more folders. So it is wrong.
I am writing to death now. Direct
While Weburl;?> Is http://www.123.com
I would like to think that this method is too dead.
Is there any other way?
Thank you for your help.

------ Solution --------------------
Well, zf has a lot of url retrieval functions. It provides many flexible methods.
In phtml:
$ This-> baseUrl () indicates Yes
If the project is demo1
Indicates/demo1/public.
Both:
Http: // localhost/demo1/public
If your css is used
Echo $ this-> baseUrl (). '/styles/global.css'
That is:
Http: // localhost/demo1/public/styles/global.css

. The meaning of baseUrl is calculated from removing the domain name. In the future, do not use relative paths when resources are referenced. To be clear

If you use
$ This-> serverUrl () returns http: // localhost


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.