php进入页面强制刷新页面_使用PHP强制安全页面

php进入页面强制刷新页面

Many pages, most often pages with forms or pages that serve personal information, require the need to be served over a secure connection. Even recreational internet users have gotten accustomed to looking for "lock" icon within their browser before inputting data into a web form. For the benefit of the business and its website visitors, it's important to ensure that a form page be secured.

许多页面,最常见的是带有提供个人信息的表格或页面的页面,需要通过安全连接进行服务。 甚至娱乐性的互联网用户也已经习惯于在将数据输入到Web表单之前在其浏览器中查找“锁定”图标。 为了企业及其网站访问者的利益,确保表单页面的安全非常重要。

To ensure that you page is served over a secure connection, you must first acquire a security certificate. Popular SSL certificate providers include Verisign, Thawte, and GoDaddy (whom I prefer). Once your SSL certificate has been installed on the server, you may add the following code snipped at the top of any page you would like secured:

为了确保通过安全连接为您的页面提供服务,您必须首先获取安全证书。 流行的SSL证书提供商包括Verisign,Thawte和GoDaddy(我更喜欢)。 在服务器上安装SSL证书后,您可以在想要保护的任何页面的顶部添加以下代码:

PHP代码 (The PHP Code)

//force redirect to secure page
if($_SERVER['SERVER_PORT'] != '443') { header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); }

The above code forces the script to run on secure port 443 as opposed to port 80. Thus, the page is served securely.

上面的代码强制脚本在与端口80相对的安全端口443上运行。因此,可以安全地服务该页面。

翻译自: https://davidwalsh.name/force-secure-page-php

php进入页面强制刷新页面

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值