使用PHP要做的6件事

PHP is a server-side programming language that is used in conjunction with HTML to enhance the features of a website. So what can you do with PHP? Here are 10 fun and useful things you can use PHP for on your website. 

PHP是一种服务器端编程语言,与HTML结合使用可增强网站的功能。 那么,您可以使用PHP做什么呢? 您可以在网站上使用PHP的10件事有趣而有用。

有会员登录 ( Have a Member Log In )

You can use PHP to create a special area of your website for members. You can allow users to register and then use the registration information to log in to your site. All of the users' information is stored in a MySQL Database with encrypted passwords.

您可以使用PHP为会员创建网站的特殊区域。 您可以允许用户进行注册,然后使用注册信息登录到您的站点。 用户的所有信息都使用加密的密码存储在MySQL数据库中

创建日历 ( Create a Calendar )

You can use PHP to find today's date and then build a calendar for the month. You can also generate a calendar around a specified date. A calendar can be used as a standalone script or incorporated into other scripts where dates are important.

您可以使用PHP查找今天的日期,然后为该月建立日历。 您还可以在指定日期前后生成日历。 日历可以用作独立脚本,也可以合并到其他重要日期的脚本中。

上次访问 ( Last Visited )

Tell users the last time they visited your website. PHP can do this by storing a cookie in the user's browser. When they come back, you can read the cookie and remind them that the last time they visited was two weeks ago.

告诉用户上次他们访问您网站的时间。 PHP可以通过在用户的浏览器中存储cookie来做到这一点。 当他们回来时,您可以阅读Cookie并提醒他们上次访问是在两周前。

重定向用户 ( Redirect Users )

Whether you want to redirect users from an old page on your site that no longer exists to a new page on your site, or you want to give them a shorter URL to remember, PHP can be used to redirect users. All of the redirection information is done server side, so it is smoother than redirecting with HTML.

要将用户从站点上不再存在的旧页面重定向到站点上的新页面,还是想给他们一个更短的URL以便记住,PHP可用于重定向用户。 所有重定向信息都是在服务器端完成的,因此它比使用HTML重定向更平滑。

添加投票 ( Add a Poll )

Use PHP to let your visitors take part in a poll. You can also use the GD Library with PHP to display the results of your poll visually instead of just listing the results in text.

使用PHP让您的访客参与投票。 您还可以将GD Library与PHP结合使用,以可视方式显示民意测验的结果,而不仅仅是以文本形式列出结果。

模板化您的网站 ( Template Your Site )

If you like to redesign the look of your site often or want to keep the content fresh on all the pages, then this is for you. By keeping all of the design code for your site in separate files, you can have your PHP files access the same design. This means when you make a change, you only need to update one file and all your pages change.

如果您想经常重新设计网站的外观,或者想让所有页面上的内容都保持新鲜,那么这是给您的。 通过将站点的所有设计代码保存在单独的文件中,可以使您PHP文件访问相同的设计。 这意味着进行更改时,只需更新一个文件,所有页面都将更改。

翻译自: https://www.thoughtco.com/cool-things-to-do-with-php-2693857

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值