簡體   English   中英

心情php頁面重定向繼續時出現重定向頁面

[英]moodle php page redirect continue page comes while redirecting

我有一個moodle頁面,並且嘗試從該頁面重定向到另一個頁面,如下所示:

redirect("page2.php?cId=".$cid);

我重定向到另一個頁面,但是在重定向時,我正在查看以下內容:

在此處輸入圖片說明

看起來很亂。 我想避免這種情況。

這里當前頁面有Moodle的頁眉和頁腳和page2.php沒有moodle頁眉和頁腳

如何避免出現“繼續”頁面?

確保啟用了調試 (設置為“ Developer”並顯示)。

您可能會在此處看到警告消息,該消息可能解釋了為什么重定向無法立即進行。

最可能的解釋是在調用重定向之前已經輸出了某些內容。 在重定向之前,請仔細檢查代碼中是否存在任何“回聲”或“打印”調用。

如果找不到任何'echo'或'print'調用,請確保在任何文件中打開' <?php '標記之前沒有空格(或任何其他字符),也沒有關閉' ?> '標記放在文件末尾(關閉PHP標記后很容易添加不需要的空格),並且沒有不需要的內聯HTML部分。

在您的代碼中嘗試以下操作:

redirect("page2.php?cId=".$cid, 'Loading', 1); 

這將顯示“正在加載”消息,並延遲1秒鍾。

您將需要在moodle / lib中修改outputrenderers.php文件。 查找redirect_message公共功能,您將看到一行內容如下:

$output .= '<div class="continuebutton">(<a href="'. $encodedurl .'">'. get_string('continue') .'</a>)</div>'; 

使用get_string從lang / en / moodle.php i18n文件中選擇另一個字符串,或將其全部刪除。 例如,如果您想對更多信息進行硬編碼:

$output .= '<div class="continuebutton">(<a href="'. $encodedurl .'">Please click here if you are not automatically redirected within '.$delay.' seconds</a>)</div>';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM