search
Homephp教程PHP源码zend框架关于基地址

<script>ec(2);</script>
今天发现自己原来上当啊,郁闷啊……

 在一开始看zend框架时,感觉好象谁告诉我就入口文件(index.php)一定要放在网站的有基地址上!
然后我就累不拉急的把 htdocs文件夹 (我用的是xampp安装包安装的,据说这个就是基地址的目录,呵) 下的所有文件都移走了,然来把zend的请进来,一试,成功了,呵呵,心里还老高兴了。

后来发现这样的话,我这台电脑不是只能有一个网站了吗?因为所有的都是从这个zend里的index.php开始的啊?不爽,上网搜了一圈,功夫不负 search 人!给我找到了,哈哈,
基本做法是这样的:
1.将你的网站文件移到你想的文件夹下,如 zend

2. 在C:WINDOWSsystem32driversetchosts 加一个域名, 如

.......
127.0.0.1 zendhost

其实也就是本地解析一个域名了

3.在apacheconfhttpd.conf 文件的最后加上:
............
NameVirtualHost 127.0.0.1

        ServerName zendhost
        DocumentRoot D:xampphtdocszend
        RewriteEngine On


OK,重启,在地址栏里输入:zendhost 回车,搞定爽啊,

终于可以了,可是可笑的就在这里,今天从同事里那才现在。原来,本来就没有那有复杂,其实任意放在一个文件夹下,在地址栏里输:如 127.0.0.1/zendhost 就可以了,呵呵,我真是苯啊!我后来再看了一下代码,原来是我在 index.php 里多加了一句话:

$controller->setBaseUrl(''/''); 所以所有的请来都转到根目录了!



Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor