简体   繁体   中英

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..

You have an extra apostrophe. 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('Location: ' . $edit_invoice);

Should work, as long as $edit_invoice is a valid link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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