Category: PHP
-
Post Views: 64 1. Create a new warehouse, shuijingwan/yii2-app-advanced, as shown in Figure 1 Yii 2 advanced project template, the template includes four layers: interface (the API to implement the RESTful style web service service), front-end, back-end and console, each of which is a separate YII application. 2. Successfully created the warehouse, as shown in Figure 2 3. Use the…
-
Post Views: 12 1. Reference URL:https://github.com/yiisoft/yii2-coding-standards, as shown in Figure 1 2. Clone the yiisoft/yii2-coding-standards warehouse, as shown in Figure 2 3. Enter the E:\wwwroot\yii2-coding-standards directory, and execute the installation, as shown in Figure 3 cd .\yii2-coding-standards\ composer install 4. Configure the local PHP interpreter, File | Settings → Languages & Frameworks → PHP → CLI Interpreter drop-down list, as…
-
Post Views: 14 1. Preliminary suspicion is a problem caused by the BOM header, save as the code in EditPlus: UTF-8 + BOM, as shown in Figure 1 2. Execute git commit, the difference: the text is the same, but the file does not match. The following differences are found: encoding method (ASCII, UTF-8 BOM), as shown in Figure 2…
-
Post Views: 17 1. The data structure of HTML is as follows, and now it needs to be extracted: video description. . . . , that is, the data in the first p tag 2. Search on github: yii2 html dom, and finally choose: garyjl/yii2-simple_html_dom, as shown in Figure 1 3. Execute the command: composer require –prefer-dist garyjl/yii2-simple_html_dom “*”, the…
-
Post Views: 16 1. To implement an interface to obtain the list of articles, you need to query the data based on the date control, as shown in Figure 1 2. The configuration of the verification rules is as follows 3. From_created_at, to_created_at are all empty, the verification is passed, as shown in Figure 2 4. Date (DateTime, example: 2017-03-03…
-
Post Views: 14 1. In PHP 7.1 and Yii 2, AR activity records transactions, and the implementation of multiple models needs to be operated at the same time, as shown in Figure 1 2. Test whether the transaction is supported, and let the $this->save() operation fail, and let the $contentDetail->save() operation succeed, the response is as follows, as shown in…
-
Post Views: 13 1. Edit the cached controller class, \API\Controllers\CacheController.php 2. Create the data layer of the cached resource class (the corresponding model language package file), \common\models\redis\cache.php 3. Create the logical layer of the cached resource class, \common\logics\redis\cache.php 4. In the interface application, create a cached resource class, \API\Models\Redis\Cache.php 5. In the V1 module of the interface application, create the…