PHP识别URL并显示页面

当前,可以使用localhost/dateapp/timeline?profile=user1571502747在我的网站上访问用户的时间轴。用户以后可以在此处手动将其用户名从user1571502747更改为所需的任何名称,以便于访问。现在我想要的是,如果有人打开localhost/dateapp/user1571502747(或实时时打开mysite.com/user1571502747),它会自动重定向并打开用户user1571502747的时间轴,或者说它重定向到localhost/dateapp/timeline?profile=user1571502747。但是我无法找到一种方法。当前,尝试访问时不显示页面,但页面未找到浏览器错误。当然,我还没有放任何东西,因此很自然地得到这个错误。有人可以指导我这样做吗? Facebook这样做,以供参考。预先感谢。

更新:如果需要在.htaccess文件中执行任何操作,则我当前的.htaccess文件如下。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,END]
milu_yaya 回答:PHP识别URL并显示页面

您可以为此使用.htaccess。 尝试将其添加到根目录中的.htaccess文件中

#include <iostream>
        #include <Windows.h>
        #include <Wincodec.h>
        #pragma comment(lib,"Windowscodecs.lib")

HICON hiconLarge = NULL;
HICON hiconSmall = NULL;

int main()
{
    CoInitialize(NULL);
    double x,y;

    IWICImagingFactory* piFactory = NULL;
    IWICBitmap* piBitmap = NULL;

    //Create the COM imaging factory.
    HRESULT hr = CoCreateInstance(
        CLSID_WICImagingFactory,NULL,CLSCTX_INPROC_SERVER,IID_IWICImagingFactory,(LPVOID*)&piFactory);

    UINT nIcons;
    nIcons = ExtractIconEx(L"c:\\windows\\system32\\shell32.dll",-1,0);

        ExtractIconEx(L"c:\\windows\\system32\\shell32.dll",&hiconLarge,&hiconSmall,nIcons);

    std::cout << nIcons << " icons found." << std::endl;

    HRESULT hResult = piFactory->CreateBitmapFromHICON(hiconLarge,&piBitmap);
    if (hResult == S_OK)
    {
        piBitmap->GetResolution(&x,&y);
        std::cout << "Resolution x=" << x << " y=" << y << std::endl;
    }
}
本文链接:https://www.f2er.com/3169615.html

大家都在问