Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 是否将加载文本添加到此脚本?_Php - Fatal编程技术网

Php 是否将加载文本添加到此脚本?

Php 是否将加载文本添加到此脚本?,php,Php,我正在使用Interspire link.php特性,并希望添加文本,说明页面正在加载,因为完全加载脚本需要2-5秒 我应该在哪里添加它 <?php /** * This file handles link tracking and processing. It will record the link click and then redirect to the proper location. * * @version $Id: link.php,v 1.19 2008/02/

我正在使用Interspire link.php特性,并希望添加文本,说明页面正在加载,因为完全加载脚本需要2-5秒

我应该在哪里添加它

<?php
/**
* This file handles link tracking and processing. It will record the link click and then redirect to the proper location.
*
* @version     $Id: link.php,v 1.19 2008/02/26 19:43:23 tye Exp $
* @author Chris <chris@interspire.com>
*
* @package SendStudio
*/

// Make sure that the IEM controller does NOT redirect request.
if (!defined('IEM_NO_CONTROLLER')) {
    define('IEM_NO_CONTROLLER', true);
}

// Displaying an open image does not need a session.
if (!defined('IEM_NO_SESSION')) {
    define('IEM_NO_SESSION', true);
}

// Require base sendstudio functionality. This connects to the database, sets up our base paths and so on.
require_once dirname(__FILE__) . '/admin/index.php';

if (!SENDSTUDIO_IS_SETUP) {
    exit();
}

/**
* This file lets us get api's, load language files and parse templates.
*/
require_once SENDSTUDIO_FUNCTION_DIRECTORY . '/sendstudio_functions.php';

$sendstudio_functions = new Sendstudio_Functions();

$statsapi = $sendstudio_functions->GetApi('Stats');
$subscriberapi = $sendstudio_functions->GetApi('Subscribers');
$listapi = $sendstudio_functions->GetApi('Lists');

$foundparts = array();

foreach ($_GET as $p => $part) {
    $foundparts[strtolower($p)] = $part;
}

$linktype = 'u';
if (isset($foundparts['f'])) {
    $linktype = $foundparts['f'];
}

/**
* No link? Exit.
*/
if (!isset($foundparts['l'])) {
    echo 'Invalid Link.<br>';
    exit();
}
$linkid = (int)$foundparts['l'];

/**
* No "member" info? Exit.
*/
if (!isset($foundparts['m'])) {
    echo 'Invalid Link.<br>';
    exit();
}
$subscriberid = (int)$foundparts['m'];

if (isset($foundparts['a'])) {
    $statstype = 'auto';
    $statid = $foundparts['a'];
} else {
    $statstype = 'newsletter';
    $statid = $foundparts['n'];
}

$url = $statsapi->FetchLink($linkid, $statid);
if (!$url) {
    echo 'Invalid Link.<br>';
    exit();
}

// need to decode the url in case there are custom fields with spaces in them
// eg %%first name%% (shouldn't use decode, as the custom field uses the % character which is a scpecial character for URL)
$url = preg_replace('/%20/', ' ', $url);

// make sure it's a full url.
if (strtolower(substr($url, 0, 4)) != 'http') {
    $url = 'http://' . $url;
}

$stats_info = $statsapi->FetchStats($statid, $statstype);
if (isset($stats_info['sendtype']) && $stats_info['sendtype'] == 'triggeremail') {
    $record = $subscriberapi->GetRecordByID($subscriberid);
    if (isset($record['listid'])) {
        $stats_info['Lists'] = array($record['listid']);
    }
}

$opentime = $statsapi->GetServerTime();
$openip = GetRealIp();

$open_details = array(
    'opentime' => $opentime,
    'openip' => $openip,
    'subscriberid' => $subscriberid,
    'statid' => $statid,
    'opentype' => $linktype
);

$statsapi->RecordOpen($open_details, $statstype, true);

$lists = $stats_info['Lists'];

$listinfo = $subscriberapi->IsSubscriberOnList(null, $lists, $subscriberid, false, false, true);
$subscriberinfo = $subscriberapi->LoadSubscriberList($subscriberid, $listinfo['listid'], true);

$listapi->Load($listinfo['listid']);
$subscriberinfo['listname'] = $listapi->name;

$url = trim($statsapi->CleanVersion($url, $subscriberinfo));

/**
* IE doesn't like redirecting to urls with an anchor on the end - so we'll strip it off.
$newurl = parse_url($url);
$url = $newurl['scheme'] . '://' . $newurl['host'];
if (isset($newurl['path'])) {
    $url .= $newurl['path'];
    if (isset($newurl['query'])) {
        $url .= '?' . $newurl['query'];
    }
}
*/

$clicktime = $statsapi->GetServerTime();
$clickip = GetRealIp();

$click_details = array(
    'clicktime' => $clicktime,
    'clickip' => $clickip,
    'subscriberid' => $subscriberid,
    'statid' => $statid,
    'linkid' => $linkid,
    'listid' => $listinfo['listid'],
    'url' => $url
);

$statsapi->RecordLinkClick($click_details, $statstype);

/**
 * Do Tracking module
 */
    if ($sendstudio_functions->GetApi('module_TrackerFactory', false)) {
        $status = module_Tracker::ProcessURLForAllTracker($statid, $statstype, array('url' => $url), $subscriberinfo);
        if ($status != false) {
            $url = $status;
        }
    }
/**
 * -----
 */

header('Location: ' . $url);

我已经尝试添加echo Hello world!;在不同的地方,这些代码都不起作用。

我不确定这段代码是如何调用的,但是你能试着注释这行代码吗:

header('Location: ' . $url);
并将其替换为:

echo "<script>window.location.replace('".json_encode($url)."')</script>";

如果它仍然像应该的那样重定向,您可以尝试在开头添加文本。

您不能只是“添加加载条”。我有一个速度表。我在哪里把它粘到我的车上?。你可以把它粘在任何你想粘的地方。问题是我如何让它报告我的速度。好吧,如果你在页眉之前回显任何内容,那么只显示页面加载的基本文本怎么样。。。。然后标题将不起作用。我添加了标题“位置:”$网址;回声你好世界!;下面的底线,这没有什么可能你需要一个身体和html标记。正如我所说的,我真的不知道这段代码是页面的内容还是在某些内容中被调用。