方法1 設置虛擬路徑 在apache里面 找到 httpd-vhosts.conf
打開並修改 DocumentRoot c:/wamp/www/ 這段
改成DocumentRoot c:/wamp/www/public
例如:
<VirtualHost 192.168.10.223:80>
DocumentRoot "E:\wwwroot\192.168.10.222\jingfu\public"
<Directory "E:\wwwroot\192.168.10.222\jingfu\public">
DirectoryIndex index.php index.html
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
方法2 復制public文件到根目錄 修改index.php
將../ 刪掉 。復制下面內容即可
// 定義應用目錄
define('APP_PATH', __DIR__ . '/application/');
// 定義應用緩存目錄
define('RUNTIME_PATH', __DIR__ . '/runtime/');
// 開啟調試模式
define('APP_DEBUG', true);
// 加載框架引導文件
require __DIR__ . '/thinkphp/start.php';
