我是一名有用的助手,可以为您翻译文本。
现在我有一个域名为example.com。
我想根据他的域名获取这5个用户的数据。
我正在使用Xampp,Apache服务器,因此我将httpd-vhosts文件配置为: C:\xampp\apache\conf\extra\httpd-vhosts
当我访问
我正在创建一个Web应用程序,需要为每个用户提供动态域名。
假设我的数据库中有5个用户,例如:
1) wanda
2) edward
3) rick
4) maurice
5) kristin
现在我有一个域名为example.com。
我想根据他的域名获取这5个用户的数据。
1) wanda.example.com
2) edward.example.com
3) rick.example.com
4) maurice.example.com
5) kristin.example.com
route.php
Route::group(['domain' => '{user}.example.com'], function () {
Route::get('/', function ($user) {
echo $user;
exit;
});
});
我正在使用Xampp,Apache服务器,因此我将httpd-vhosts文件配置为: C:\xampp\apache\conf\extra\httpd-vhosts
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/myproject"
ServerName example.com
ServerAlias *.example.com
DirectoryIndex index.php
<directory "C:/xampp/htdocs/myproject">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
C:\Windows\System32\drivers\etc\hosts文件
127.0.0.1 example.com
127.0.0.1 *.example.com
当我访问
user.example.com
时,出现了这个错误。
我想要这种动态域名的工作方式。http://wanda.thewallchat.com/
http://edward.thewallchat.com/