假设我有一个Web服务器(nginx)server.com,我只有一个php文件index.php(没有目录结构).我希望能够在server.com之后访问任何内容.它将是一个网址结构.例如server.com/google.com,server.com/yahoo.com.au等...
一个例子是http://whois.domaintools.com/google.com(他们没有名为/google.com的目录,对吧?)
Q1:如何从index.php访问'server.com'之后的内容
Q2:我可以从这样的URL获取协议吗?例如server.com/http://www.google.com或server.com/https://www.google.com
PS 我不确定这里是否正确使用术语虚拟目录.我只想做我在其他地方看到的事情.
我在Windows 8,XAMPP 1.8.1,PHP 5.4.7和MySQL上使用Apache服务器.我决定将我的代码转换为PDO.
检查我的phpinfo()似乎启用了MySQL的PDO驱动程序,但我仍然继续收到"找不到驱动程序"错误.
这是代码:
<?php
//connect to database
$config['db'] = array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'x'
);
$db = new PDO("
pdo_mysql:host= " .$config['db']['host']. ";
dbname= " .$config['db']['dbname']. ";
username= " .$config['db']['username'].";
password= " .$config['db']['password']."
");
?>
Run Code Online (Sandbox Code Playgroud)
而错误:
致命错误:未捕获的异常'PDOException',消息'找不到驱动程序'
有什么建议?