douke3442 2013-01-01 22:16
浏览 54
已采纳

谎言\使用youtube链接进入数据库[关闭]

this is so that when I lie a link into my database then tag / download video and lie it on the page like this

so when it is that I lie it into the database so it's going to look like this in the database, and I can not really figure out what is wrong since there doing this then to be \ into like it the link in php

show here:

this is how I think of it. However, I did not try anything. but here is my code for my site:

<tr>
                    <td>Video:</td>
                    <td><input type="text" name="video"></td>
                </tr>

and my code to all my infomation to youtube

if ($stmt = $this->mysqli->prepare("INSERT INTO `artiker` (`title`, `kort`, `video`, `tekst`, `img`, `img_title`) VALUES (?, ?, ?, ?, ?, ?)")) { 

            $stmt->bind_param('ssssss', $title, $kort, $video, $tekst, $img, $img_title);

            /* Sæt værdier på parametrene */
            $title = $_POST['title']; 
            $kort = $_POST['kort'];
            $video = $_POST['video'];
            $tekst = $_POST['tekst'];
            $img = $pb;
            $img_title = $_POST["img_title"];

            /* Eksekver forespørgslen */
            $stmt->execute();

            /* Luk statement */
            $stmt->close();

            ?>
            <script language="javascript" type="text/javascript">  
                window.location.href = "/artikler-programmering/";  
            </script> 
            <?php

        } else {
            /* Der er opstået en fejl */
            echo 'Der opstod en fejl i erklæringen: ' . $this->mysqli->error;
        }   

Really hope you can help me to not set \ into my youtube links

  • 写回答

2条回答 默认 最新

  • donglao7947 2013-01-01 22:26
    关注

    Just a guess... After you retrieve the youtube link from the database, you will want to call stripslashes() on the video link.

    What that function will do is transform:

    https:\/\/www.youtube.com\/watch?v=RlfLCWKxHJ0
    

    into

    https://www.youtube.com/watch?v=RlfLCWKxHJ0
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?