php 循环重定向,PHP头重定向循环

我遇到一个问题,用户可以将事件提交给日历,但我无法将它们重定向回原始页面.我尝试过使用:

header("Location: http://localhost/Project/View/Home.php");

exit;

但我收到一条消息此网页有一个重定向循环

HTML – Home.php

Content:

style="border: 0" width="1000" height="600" frameborder="0" scrolling="no">

PHP – Cal.php

$path = '/opt/lampp/htdocs/Project/ZendGdata-1.12.0/library';

$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);

require_once 'Zend/Loader.php';

Zend_Loader::loadClass('Zend_Gdata');

Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

Zend_Loader::loadClass('Zend_Gdata_Calendar');

// User whose calendars you want to access

$user = 'email@gmail.com';

$pass = 'password';

$serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar

$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $serviceName);

$service = new Zend_Gdata_Calendar($client);

// Create a new event object using calendar service's factory method.

// We will then set different attributes of event in this object.

$event= $service->newEventEntry();

// Create a new title instance and set it in the event

$event->title = $service->newTitle("Service");

$event->content = $service->newContent(isset($_POST["Content"]));

// Create an object of When and set start and end datetime for the event

$when = $service->newWhen();

// Set start and end times in RFC3339 (http://www.ietf.org/rfc/rfc3339.txt)

$when->startTime = "2012-10-20T16:30:00.000+05:30"; // 8th July 2010, 4:30 pm (+5:30 GMT)

$when->endTime = "2012-10-20T17:30:00.000+05:30"; // 8th July 2010, 5:30 pm (+5:30 GMT)

// Set the when attribute for the event

$event->when = array($when);

// Create the event on google server

$newEvent = $service->insertEvent($event);

// URI of the new event which can be saved locally for later use

$eventUri = $newEvent->id->text;

header("Location: http://localhost/Project/View/Home.php");

exit;

?>

解决方法:

看起来原因是

在你的home.php

您需要在标题重定向周围添加条件.

您可以使用:

if(isset($_POST['Content']))

header("Location: http://localhost/Project/View/Home.php");

标签:html,php,redirect,header

来源: https://codeday.me/bug/20190901/1785102.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值