简体   繁体   English

即将过期的网址:代码点火器

[英]Expiring URL: Code Igniter

Hi I've been trying to Send Urls to customers after order has been made in a e-commerce site, a Electronic Biling will be sent to the customer with a URL of the payment page, Now what I want to do is to make that URL expire in 2 days if he/she has not made any payment. 您好,我一直在尝试在电子商务网站上下订单后向用户发送Urls,电子账单将通过付款页面的URL发送给客户,现在我要做的就是如果他/她未付款,URL将在2天内过期。 Im using PHP CI and new to it, Any tips will be appreciated guys. 我正在使用PHP CI和它的新功能,任何提示将受到赞赏。 Thanks 谢谢

I would crate a table in the database to hold tokens ( or store a token with the order ), which would just be a unique ( somewhat random string ) then in that table you can add a created time. 我将在数据库中创建一个表以保存令牌(或使用order存储令牌),该令牌将是唯一的(有些随机字符串),然后可以在该表中添加一个创建的时间。 You could also associate this to the order and user that it belongs to. 您也可以将其与订单和所属的用户相关联。

You would use this token as a parameter for the url, for example 您将使用此标记作为url的参数,例如

www.yoursite.com/payments/abesc90ksade8

With the end part abe... the token. 末尾是……令牌。 then in the controller for that page you can query the database for the token sent, and depending on the current date and the created date, either generate your payment page, or show them and expiration error etc... 然后在该页面的控制器中,您可以查询数据库中已发送的令牌,并根据当前日期和创建的日期来生成您的付款页面,或显示它们以及到期错误等。

If you need more info just ask. 如果您需要更多信息,请询问。

What I like to do to generate tokens is this 我想做的就是生成令牌

$token = md5( microtime() );

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

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