亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

重定向到站點并跳轉到錨點

重定向到站點并跳轉到錨點

慕森王 2021-12-02 19:51:46
我嘗試重定向到一個站點并跳轉到該站點上的錨點。錨是 #tab-5我試過:window.location.href = "/property/details?id=123#tab-5";和window.location.replace("/property/details?id=123#tab-5");我還嘗試使用包含域名的完整 URL。但該網站不會重新加載。URL 只是被替換,它不會跳轉到錨點。.htaccess<IfModule mod_rewrite.c>    RewriteEngine On    # Send would-be 404 requests to Craft    RewriteCond %{REQUEST_FILENAME} !-f    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]    RewriteRule (.+) index.php?p=$1 [QSA,L]</IfModule>索引.php<?phpob_start();session_name("xxx");session_start();include("app/Routes.php");$template = checkRoute();// Redirect to login page if user is not logged inif (!$template && !isset($_SESSION["logged_in"])) {    $bodyClass = "login";    $template = "templates/php/login.php";// Redirect to start page (list view) if user is logged in and no url is given} else if (!$template) {    header("Location: /property/list");    exit;}// Redirect to templateif (file_exists($template)) {    require_once($_SERVER["DOCUMENT_ROOT"] . "/master.php");    exit;}應用程序/Routes.php<?php/** * A .htaccess rule always calls the index.php if a file could not be found. * This method gets called by index.php and creates a path out of the request * url path and returns the affiliated template file if exist. If nothing is found, * then return "no-route" template. */function checkRoute(){    $redirectUrl = (isset($_SERVER["REDIRECT_URL"])) ? $_SERVER["REDIRECT_URL"] : "";    $_SERVER["REDIRECT_URL"] = "";    if (!empty($redirectUrl) && $redirectUrl !== "/login") {        $templateRoot = "templates";        $template = $templateRoot . "/php". $redirectUrl .".php";    }}
查看完整描述

1 回答

?
鳳凰求蠱

TA貢獻1825條經驗 獲得超4個贊

我通過window.location.reload()在它之后調用解決了它


查看完整回答
反對 回復 2021-12-02
  • 1 回答
  • 0 關注
  • 240 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號