如何避免元标记在PHP中运行

时间:2019-11-06 13:07:54

标签: javascript php html

我有一个PHP代码:

if(url_validation($stepURL)==true) {
    $html = file_get_contents($stepURL);

    if (strpos($html, '<link rel="canonical" href="https://www.instagram.com/') !== false) {
        $channelID = get_string_between($html, '<link rel="canonical" href="https://www.instagram.com/', '">');
    }

    function buttonOnClick() {
        window.open('https://www.instagram.com/".$channelID."','_blank');
        setTimeout(aTagChange, 12000);
    }
}

动态运行代码时,我会在window.open位置获得此输出:

function buttonOnClick()  {
{
     window.open('https://www.instagram.com/niyamxsept/" />
        <meta content="2,488 Followers, 496 Following, 312 Posts - See Instagram photos and videos from ✡️ नियम (@niyamxsept)" name="description" />

        <meta property="og:type" content="profile" />
        <meta property="og:image" content="https://scontent-lax3-1.cdninstagram.com/vp/3afc2c1223e6ad4d2ccd1e2961d39148/5E5C3033/t51.2885-19/s150x150/76876300_855768418153554_1560420219170586624_n.jpg?_nc_ht=scontent-lax3-1.cdninstagram.com" />
        <meta property="og:title" content="✡️ नियम (@niyamxsept) • Instagram photos and videos" />
        <meta property="og:description" content="2,488 Followers, 496 Following, 312 Posts - See Instagram photos and videos from ✡️ नियम (@niyamxsept)" />
        <meta property="og:url" content="https://www.instagram.com/niyamxsept/" />



        <script type="application/ld+json">
            {"@context":"http:\/\/schema.org","@type":"Organization","name":"\u2721\ufe0f \u0928\u093f\u092f\u092e","alternateName":"@niyamxsept","description":"22\ud83d\udc40\n6 Sep \ud83d\udc79\nGrow \ud83c\udf31\nVirgo \ud83d\ude46\nh\u0259r\u02d0m\u026at\nRajput \ud83c\udf43\nSpread love \u2764 \n\ud83c\udf41 @mrniamster\n\ud83d\udc7b : mrniamster\n\u262eI Roll Dollars While You Sleep \ud83e\udddf","url":"http:\/\/www.youtube.com\/iamniamster","mainEntityofPage":{"@type":"ProfilePage","@id":"https:\/\/www.instagram.com\/niyamxsept\/","interactionStatistic":{"@type":"InteractionCounter","interactionType":"http:\/\/schema.org\/FollowAction","userInteractionCount":"2488"}},"image":"https:\/\/www.instagram.com\/static\/images\/ico\/favicon-200.png\/ab6eff595bb1.png"}
        </script>

我想要什么?

 function buttonOnClick()  {
 {
     window.open('https://www.instagram.com/niyamxsept','_blank');
     setTimeout(aTagChange, 12000);
 }

我不知道为什么元标记等会出现在我的输出中,我也尝试删除规范。

0 个答案:

没有答案