简体   繁体   English

PHP重定向/加载另一个页面

[英]PHP redirect/load another page

I know how to redirect/load with this code' 我知道如何使用此代码重定向/加载'

header('Location: http://www.someURL.com');

But what about using with strings? 但是,如何使用字符串呢?

$edit_invoice = $invoice->invoice->links->edit;
header( 'Location: '.$edit_invoice.' ) ;

I'm using Freshbooks API library in case you're wondering.. 我正在使用Freshbooks API库,以防万一。

You have an extra apostrophe. 您有一个多余的撇号。 header( 'Location: '.$edit_invoice ) ; header('Location:'。$ edit_invoice);

The way you have the string version set up right now won't work, because you're starting a new string at the end of calling the header() function. 您现在设置的字符串版本的方法将不起作用,因为您将在调用header()函数结束时开始新的字符串。

header('Location: ' . $edit_invoice);

Should work, as long as $edit_invoice is a valid link. 只要$edit_invoice是有效的链接, $edit_invoice应该起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM