Home  >  Article  >  Backend Development  >  PHP safe string development ideas and code sharing

PHP safe string development ideas and code sharing

黄舟
黄舟Original
2017-08-15 14:01:371401browse

In our previous articles, we have always introduced to you how to intercept strings and convert strings. So today's course will introduce to you the development of PHP safe strings. Before that, When writing the cookie value, I looked at the cookie files of Google and Baidu. The value inside is a long string of characters. So I will introduce to you how to generate a safe string.

1. Before we start, we need to download the PHP secure string library we need for this section: //m.sbmmt.com/xiazai/leiku/607

2. After the download is complete, know the php class library file, unzip it to the local directory, and create a new php file!

3. Call the class in the new php file and instantiate it:

<?php
include_once "stringanquan.php"; //引入类库
$obj= new genRandomString();     //实例化类
$obj->len=&#39;30&#39;;                  //len 为自定义的字符长度
echo $obj->provideRandString();   //输出安全字符串

Finally run the file, the running result is as shown below:

PHP safe string development ideas and code sharing

The above is the detailed content of PHP safe string development ideas and code sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn