PHP multiprocess processing tcp connection

<?php if(($sock = socket_create(AF_INET, SOCK_STREAM, 0)) < 0) { echo "failed to create socket: ".socket_strerror($sock)."n"; exit(); } if(($ret = socket_bind($sock,'127.0.0.1', 8888)) < 0) { echo "failed to bind socket: ".socket_strerror($ret)."n"; exit(); } if( ( $ret = socket_listen( ...

Posted on Thu, 28 May 2020 10:07:18 -0400 by jay7981

Installation and verification of JWT Auth in laravel (example)

Installation and verification of JWT Auth in laravel   1. Use composer to install jwt, cmd to the project folder; Composer require tymon / JWT auth 1.0. * (here the version number is written according to your own needs) Install jwt, refer to official documentation https://jwt-auth.readthedocs.io/en/docs/laravel-installation/ 2. If the laravel v ...

Posted on Thu, 28 May 2020 08:48:45 -0400 by bacarudaguy

PHP PDO mysql abstraction layer

Using PDO constructor to connect database and DSN <?php $dbms = 'mysql'; $dbname = 'test'; $user = 'root'; $pwd = '123456'; $host = 'localhost'; $dsn = "$dbms:host=$host;dbName=$dbname"; try{ $pdo = new PDO($dsn,$user,$pwd); echo 'pdo Successfully connected to database'; }catch(Exception $e){ echo $e->getMessage().'<br&gt ...

Posted on Mon, 25 May 2020 04:04:46 -0400 by duall

php connect and operate mysql database

php connects to mysql database Five steps for PHP to access MYSQL database 1. Connect to MySQL database Using MySQL_ The connect() function establishes a connection to the MySQL server. 2. Select MySQL database Using MySQL_ select_ The db() function selects the database of the MySQL database server. 3. Execute SQL statement Using MySQL in the s ...

Posted on Sun, 24 May 2020 23:44:39 -0400 by qbox

php form form validation + submit to database

Verification details of php forms First of all, we process all the data submitted by the user through the htmlspecialchars() function of PHP. Converts special characters to HTML entities. This means that HTML characters such as < and > are replaced with & lt; and & gt. This prevents attackers from injecting HTML or JavaScript Code ...

Posted on Sun, 24 May 2020 22:02:21 -0400 by sgiandhu

nginx lua scripts manipulate pits in file directories or default paths to files

BUG s have recently appeared online, and it is after server migration that a lua script that finds nginx cannot collect log data for nginx After sorting, it was found that because lua could not find the corresponding file, the nginx data could not be written to the file.That is, lua cannot create the create file directory and therefore cannot f ...

Posted on Fri, 22 May 2020 23:54:39 -0400 by davidx714

ThinKPHP6.0 hands on

Install ThinkPHP6.0 cd to the project directory, and then do the following Prepare to install the framework: composer create project topthink / think thinkphp6.0 cd switch to the thinkPHP6.0 directory of PHP project Modify configuration file:. Env configuration file / / copy example.env Change to your own Open debug mode: app in. env_ DEBUG = ...

Posted on Fri, 22 May 2020 10:08:32 -0400 by benny_g

php form form concept

The input field mark introduced by PHP form element < input > Input field flag < input > The input field tag < input > is one of the most commonly used tags in forms. Common input field markers < input > include text box, button, radio button, check box, etc. type attribute values and examples and descriptions: 1. text e ...

Posted on Fri, 22 May 2020 00:53:02 -0400 by farsighted

Submit forms and upload pictures using FormData form data objects

Using FormData form data objects in H5, the name and value of all form elements in the form form form can be combined into a request string and submitted to the background.You can use js to simulate a series of form controls with some key-value pairs, or you can use the send() method of XMLHttpRequest to submit the form asynchronously. <bo ...

Posted on Thu, 21 May 2020 12:37:40 -0400 by fean0r

Three solutions for PHP concurrency scenario

In the concurrency scenarios such as seckill and rush to buy, oversold may occur. There is no native concurrency solution in PHP language, so we need to use other methods to achieve concurrency control. Common solutions listed are: With queue, an extra process is set up to process the queue, and the concurrent requests are put into the queue. I ...

Posted on Thu, 21 May 2020 10:24:07 -0400 by jtmathome