update and updateByQuery methods for elasticsearch in PHP

When using ES, we often encounter the situation of updating data, Here is a brief introduction: First, the most common and efficient method is to update according to id. at this time, the update method is called:      public static function updateEsById($id,$data = [])         {                  if (empty($id) || empty($data)) ...

Posted on Mon, 02 Dec 2019 05:19:48 -0500 by dotbands

ES6 Foundation - ES6 class

Author| Jeskson Source|Dada Front End Bistro ES - Class Classes and Object Oriented: Object-oriented, that is, everything is object. Object-oriented is a way of developing our thinking. Everything is object in object-oriented thinking. Take human as an example, what are its characteristics.Examples include name, gender, birth year, height, a ...

Posted on Mon, 02 Dec 2019 02:02:27 -0500 by amity

Views and templates for ThinkPHP

In short, a controller corresponds to a view, and a method corresponds to a template. Let's go to the figure above.   2. Assign value to template Assign() function is used to assign template. The first parameter of assign() function is to give a user-defined name to the value, and the second parameter is the value Chestnut: public function te ...

Posted on Mon, 02 Dec 2019 01:13:47 -0500 by jsantama

MySQL - difference between internal connection and external connection

Difference inner join: take out the matched data in two tables, and do not keep the unmatched data outer join: take out the matched data in the connection table, and the unmatched data will be retained. Its value is NULL Example table users table mysql> select * from users; +----+-------+ | id | name | +----+-------+ ...

Posted on Sun, 01 Dec 2019 22:52:34 -0500 by stormchaser1_1

Laravel uses middleware for permission control

First look File Laravel middleware provides a convenient mechanism to filter HTTP requests entering the application. Here we implement a function that only the admin role can access specific routes New middlewarephp artisan make:middleware MustBeAdmin Open the generated \ app\Http\Middleware\MustBeAdmin.php to modify the handle m ...

Posted on Sun, 01 Dec 2019 19:12:42 -0500 by viv

Mailer's email sending and receiving details in Yii2.0

The class encapsulated by Yii2.0 is powerful enough. The usage of Mailer is summarized as follows:1. Configure in main-local.php first: return [//....'components' => ['mailer' => ['class' => 'yii\swiftmailer\Mailer',],],]; The details are as follows: return [//....'components' => [ 'viewPath' => '@common/mail', ...

Posted on Sun, 01 Dec 2019 19:05:25 -0500 by sharke

laravel/passport implements API authentication (laravel 5.6)

Part 1: install Passport(laravel/passport) Step 1. Use Composer to install Passport:composer require laravel/passport=~7.0 Step 2. The Passport service provider uses the framework to register its own database migration directory, so after registering the provider,You should run the Passport migration command to automatically create a data ta ...

Posted on Sun, 01 Dec 2019 17:09:21 -0500 by MeOnTheW3

Function calculation php runtime compilation non built in extension

php runtime using FAQ problem The php version in the function calculation php runtime is 7.2.7. There are many built-in extensions in php runtime, as follows: "Core", "date", "libxml", "openssl", "pcre", "zlib", "curl","filter", "hash", "readline", "Reflection", "SPL", "session","xml", "standard", "mysqlnd", "bcmath", "bz2", "calendar","ctype ...

Posted on Sun, 01 Dec 2019 14:43:18 -0500 by Anant

Special object array in JS

Preface Previously learned data types can only store one value (for example: Number/String). I want to store multiple values in a variable. How should I store them? The so-called array is to arrange multiple elements (usually of the same type) in a certain order into a collection, which we call array. 1.1 array creation // Creating arrays i ...

Posted on Sun, 01 Dec 2019 12:34:37 -0500 by The Phoenix

Rewriting error handling in the format request of the Laravel framework

The default validate validation in the laravel framework returns to the previous page by default when handling errors, and only returns to Json when it is ajax. If we want to return Json all the time, we need to override error handling As follows: only create a new BaseRequest class in the Requests directory The code is as follows <?php /* ...

Posted on Sun, 01 Dec 2019 12:19:40 -0500 by Kevmaster