我在文件的末尾有一个问题,如下图所示
错误显示在页面末尾的位置< / HTML> ;.我试图编辑文件没有任何成功,所以我需要有人给我这样的提示我的代码中的问题.
请帮我理解我的问题所在.
谢谢您的帮助.
<?PHP
/*
* copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
session_start();
require_once '../../src/apiclient.PHP';
require_once '../../src/contrib/apiPagespeedonlineservice.PHP';
$client = new apiclient();
$client->setApplicationName("PageSpeedOnline_Example_App");
$service = new apiPagespeedonlineservice($client);
if (isset($_GET['url'])) {
$result = $service->pagespeedapi->runpagespeed($_GET['url']);
}
?>
<!doctype html>
<html>
<head><link rel='stylesheet' href='style.css' /></head>
<body>
<header><h1>Google Page Speed Sample App</h1></header>
<div class="Box">
<div id="search">
<form id="url" method="GET" action="index.PHP">
<input name="url" class="url" type="text">
<input type="submit" value="Analyze Performance">
</form>
</div>
<?PHP if (isset($result)): ?>
<div class="result">
<h3>Summary</h3>
<?PHP print $result['title']; ?> got a PageSpeed score of <b><?PHP print $result['score']; ?></b> (out of 100).
<div>Title: <?PHP print $result['title']; ?></div>
<div>score: <?PHP print $result['score']; ?></div>
<div>Number of Resources: <?PHP print $result['pageStats']['numberResources']; ?></div>
<div>Number of Hosts: <?PHP print $result['pageStats']['numberHosts']; ?></div>
<div>Total Request Bytes: <?PHP print $result['pageStats']['totalRequestBytes']; ?></div>
<div>Number of Static Resources: <?PHP print $result['pageStats']['numberStaticResources']; ?></div>
<pre><?PHP var_dump($result); ?></pre>
</div>
</div>
</body>
</html>
解决方法:
缺少<?PHP endif; ?>对于
<?PHP if (isset($result)): ?>
它可能应该在第一个< / div>之后,这是:
</div>
<?PHP endif; ?>
</div>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。