简体   繁体   中英

How URLENCODE be used within HEADER('Location:') command?

i have a php code i want header command work with URLENCODE

header("location:invoice.php?userID=".$userID."&invoiceID=".$invoiceID);

the url show like this below and i want when username call from database if in username any special character like "&" with help of URLENCODE in url & into %26 so URL work perfectly.

https://domainname.com/invoice.php?userID=Aayaan&Arbab&invoiceID=13314
header("location: invoice.php?userID=". urlencode($userID)."&invoiceID=".$invoiceID);

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