我需要问您如何从PHP运行.htaccess,因为我正在制作软件,但我希望用户可以通过语言设置自己的链接名,但我只能在.htaccess中这样做,但在.htaccess中,我不知道如何从PHP语言中获取,然后使用它来指定将存在哪些补丁。另外,我还想在PHP中创建友好的URL(从.php?id=0到.php/id/0)。
最后一个..。cURL。
在一个软件中,我看到了如何使用cURL读取页面文本(我有链接my.ip.com/idk.php?id=3,服务器上的id 3只会说文本"ok“,我希望将该文本发送到PHP并使用它)
发布于 2018-10-18 01:07:51
1)您不能使用任何东西运行.htaccess。它是您的web服务器的配置文件。
2) http://you.com/@username实例
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^@(.+)$ profile.php?username=$1 [L,QSA]然后在$_GET["username"]中获取profile.php
3)你应该做你自己的.htaccess RewriteRule
4)关于cURL的小例子。
<?php
$post = [
'PostName' => 'PostValue'
];
$ch = curl_init('http://www.example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
?>https://stackoverflow.com/questions/52863848
复制相似问题