Get fullUrl in laravel 5.1

后端 未结 3 1425
迷失自我
迷失自我 2020-12-28 14:10

i have multiple bootstrap tabs where each one do different action from others tabs for exmaple

app-url/users#creat-admin-users-tab app-url/users#

3条回答
  •  佛祖请我去吃肉
    2020-12-28 14:43

    It's true - the only way to get the "#" for now is to use js e.g. like this:

    var hash = window.location.hash;
    var tabName1 = '#creat-admin-users-tab';
    var tabName2 = '#creat-regular-users-tab';
    if (hash.indexOf(tabName1) !== -1) console.log("It's creat-admin-users-tab");
    else if (hash.indexOf(tabName2) !== -1) console.log("It's creat-regular-users-tab");
    

    And this can help you for the other parts of the url (add it in your route file):

    use Illuminate\Http\Request;
    
    Route::get('/app-url/users', function (Request $request) {
        $fullUrl = $request->fullUrl();
        var_dump($fullUrl);
    });
    

提交回复
热议问题