Php 如何防止Wordpress在<;头>;标签?

Php 如何防止Wordpress在<;头>;标签?,php,wordpress,Php,Wordpress,我正在尝试建立一个Wordpress网站,使用Forte作为支付处理器进行支付 我被告知将以下代码放在WordPress的header.php中: <!DOCTYPE html> <?php $api_access_id = OURSECRETID; $api_secret_key = ORUSECRETKEY; $location_id = OURSECRETLOCATION; $version = '2.0'; //date_default_timezone_set(&qu

我正在尝试建立一个Wordpress网站,使用Forte作为支付处理器进行支付

我被告知将以下代码放在WordPress的header.php中:

<!DOCTYPE html>
<?php
$api_access_id = OURSECRETID;
$api_secret_key = ORUSECRETKEY;
$location_id = OURSECRETLOCATION;
$version = '2.0';
//date_default_timezone_set("America/Chicago");
//$unixtime = strtotime(gmdate('Y-m-d H:i:s'));
//$millitime = microtime(true) * 1000;
//$utc = number_format(($millitime * 10000) + 621355968000000000 , 0, '.', '');
$utc = get_utc();

$token_array = ['customer_token' => '', 'paymethod_token' => ''];

function get_utc()
{
    $utc = '';

    try
    {
        //do CURL stuff here
        $curl_handle = curl_init("https://sandbox.forte.net/checkout/getUTC?callback=?");
        curl_setopt($curl_handle, CURLOPT_BINARYTRANSFER, true);
        curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
        $curl_response = curl_exec($curl_handle);
        curl_close($curl_handle);

        $start = stripos($curl_response, "(", 0) + 1;
        $end = stripos($curl_response, ")", $start);

        $utc = substr($curl_response, $start, $end - $start);
    }
    catch(Exception $e)
    {
        echo "<br/>An exception occurred. The exception is: " . $e . "<br/>";
        $utc = 0;
    }

    return $utc;
}

function reset_tokens($token_array)
{
    $token_array['customer_token'] = '';
    $token_array['paymethod_token'] = '';

    return ($token_array);
}

function calculate_hmac_md5_hash($api_access_id, $method, $version, $totalamount, $utc, $ordernumber, $customer_token, $paymethod_token, $api_secret_key)
{
    $data = "$api_access_id|$method|$version|$totalamount|$utc|$ordernumber|$customer_token|$paymethod_token";
    $hash = hash_hmac('md5', $data, $api_secret_key);
    return $hash;
}
?>
<head>  
    <script>
        function invoke_FCO_modal()
        {
                        document.getElementById('btn1').click();                                          
        }
        function oncallback(e)
        {
                        $('#response').html(e.data);
        }                             
    </script>
    <script type="text/javascript" src="https://sandbox.forte.net/checkout/v2/js"></script>
    <script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
我不明白为什么会发生这种情况,也不知道如何防止这种情况发生。我使用的是标准的2020 WordPress主题


怎么办?

WP或PHP到底能工作吗?我的意思是显示你的帖子,你能登录吗?如果不是,我认为这是一个复制品。是的,该网站在其他方面工作正常。GoDaddy称之为“托管WordPress网站”。只是当我将代码放在2020 WordPress主题的header.php文件中的head标记中时,它无法正常工作(或任何其他主题。我尝试过不同的主题,但它们并不容易理解。我知道Python,但html和php对我来说并不陌生,这就是为什么我看不出它为什么不能按指示工作。奇怪。应该没有任何区别,但试着将
块移到
上方,所以它在任何htm之前。)l、 如果查看源代码,生成的HTML是什么样子的?
'', 'paymethod_token' => '']; function get_utc() { $utc=''; try { //do CURL stuff here $curl_handle=curl_init("https://sandbox.forte.net/checkout/getUTC?callback=?"); curl_setopt($curl_handle, CURLOPT_BINARYTRANSFER, TRUE); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE); $curl_response = curl_exec($curl_handle); curl_close($curl_handle); $start=stripos($curl_response, "(", 0) + 1; $end=stripos($curl_response, ")", $start); $utc=substr($curl_response, $start, $end-$start); } catch (Exception $e) { echo "
An exception occurred. The exception is: " . $e . "
"; $utc=0; } return $utc; } function reset_tokens($token_array) { $token_array['customer_token']=''; $token_array['paymethod_token']=''; return ($token_array); } function calculate_hmac_md5_hash($api_access_id, $method, $version, $totalamount, $utc, $ordernumber, $customer_token, $paymethod_token, $api_secret_key) { $data = "$api_access_id|$method|$version|$totalamount|$utc|$ordernumber|$customer_token|$paymethod_token"; $hash = hash_hmac('md5',$data,$api_secret_key); return $hash; } ?>