PHP ile gelen URL tabanlı URL işlemek için

4 Cevap php

How can you manipulate the destination URL by the name of the starting url?

Benim URL

www.example.com/index.php?ask_question

Ben hedef URL'ye aşağıdaki manipülasyon yapmak

    if ($_GET['ask_question']) {                        
            // Problem HERE, since if -clause is always false
        if ( $login_cookie_original == $login_cookie )
        {
            include "/codes/handlers/handle_login_status.php";
            header("Location: /codes/index.php?ask_question");
            die("logged in - send your question now");
        } 
    }

4 Cevap

Sana ile değiştirmek istiyorum düşünüyorum:

if (isset($_GET['ask_question'])) {

Bu URL'ye yer eğer tek gerçek olacak.

if (isset($_GET['ask_question'])) {          
    ...

Eğer $ _GET bir print_r () yaptıysak görürdünüz

Array
(
    [ask_question] => 
)

hangi ask_question ayarlı olduğunu gösterir, ama boş, bu yüzden yanlış testleri.

muhtemelen o ask_question 'içerip içermediğini görmek için $ _SERVER [' QUERY_STRING '] değişkeni kontrol edebilir

edit: yazım hatası sabit