Tag:yii

  • word/excel/ppt 2 PDF

    Time:2022-12-8

    PHP implements word/excel/ppt conversion to PDF Generally, the most common is to use OpenOffice to convert, let’s take a look at the core code of the implementation: class PDFConverter { private $com; /** * need to install openoffice and run in the background * soffice -headless-accept=”socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard */ public function __construct() { try { $this->com […]

  • yii2-Ueditor Baidu editor

    Time:2022-12-7

    Today, I read a tutorial about uploading pictures on the Internet, and I debugged it after a setback. Now I will post the relevant code and its description for the reference of friends who are using it for the first time. Download yii2.0-ueditor download path: https://link.jianshu.com?t=https://github.com/org-yii-china/yii2-ueditor/archive/master.zip Effect demo: installation method: 1. Download yii2-ueditor2. Modify the […]

  • The solution to the problem that ueditor cannot upload pictures

    Time:2022-12-6

    When uploading a picture, an upload error is displayed. The problem should be solved by doing the following: In the getFullName() function of the common/widgets/ueditor/Uploader.php file, Modify the behavior of $randNum $randNum=rand(1, 9999) . rand(1, 999);

  • Yii reversible encryption and decryption

    Time:2022-12-5

    Generate random numbers Method: generateRandomString usage: $key = Yii::$app->security->generateRandomString(); encryption Method: encryptByPassword usage: $password_hash = Yii::$app->getSecurity()->encryptByPassword($password, $key) Parameter Description: parameter type Remark $password string password to encrypt $key string Salt set by yourself decrypt Method: decryptByPassword usage: $data = Yii::$app->getSecurity()->decryptByPassword($password_hash, $key); Parameter Description parameter type Remark $password_hash string content to decrypt $key string Salt set […]

  • Year-end welfare giveaway Baidu Cloud Double Twelve Thanksgiving for you

    Time:2022-12-4

    In the business world, data is becoming the new “oil”, and how to mine “oil” and how to transform it into commercial value through storage, transportation, processing, etc., is inseparable from new infrastructure. As the carrier of “data oil”, cloud computing is covering every field of people’s life, such as finance, transportation, steel, agriculture, etc., […]

  • yii2 url rewrite hides index.php method

    Time:2022-12-3

    Step 1: Regardless of whether it is apache or nginx, if you want to hide the Index.php file, you need to open the configuration of the urlManager component and perform subsequent operations Step two: Under nginx: The content of the configuration file nginx.conf is as follows: user centos; worker_processes 4; error_log logs/error.log; pid logs/nginx.pid; events […]

  • PHP common function collection

    Time:2022-12-2

    1.curl operation POST method public static function httpPost($url, $param = ”) { $ch1 = curl_init(); if (version_compare(PHP_VERSION, ‘5.5.0’, ‘>’)) { curl_setopt($ch1, CURLOPT_SAFE_UPLOAD, false); } curl_setopt($ch1, CURLOPT_URL, $url); curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, false); if (!empty($param)) { curl_setopt($ch1, CURLOPT_POST, 1); curl_setopt($ch1, CURLOPT_POSTFIELDS, $param); } curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch1); curl_close($ch1); return $result; } GET method […]

  • Yii2.0 RESTful API Basic Configuration Tutorial [Reprint]

    Time:2022-12-1

    Recently, I was working on the Yii2.0 RESTful API function. After searching for information for a long time, I found this kind of tutorial. Thanks to the author. The following content has been modified according to the actual situation of my project. Install yii2.0 After installing Composer, you can install Yii application templates by running […]

  • Yii2.0 RESTful API Authentication Tutorial [Token Verification]

    Time:2022-11-30

    Recently, I am working on the RESTful API authentication function, recording the whole process for later viewing. This article refers tohttps://segmentfault.com/a/1190000016368603Part of the content, thanks to the author for sharing, the following content has been adjusted according to the actual situation of my project. Certification introduction Unlike web applications,RESTful APIsare generally stateless, which means that […]

  • yii2-swoole-websocket, supports JSONRPC to deliver asynchronous tasks to workers via WS, HTTP, and Redis

    Time:2022-11-29

    https://github.com/immusen/yii2-swoole-websocket Example: Chat room case, sample code: /websocket/controllers/RoomController.php Send a message: { “jsonrpc”:”2.0″, “id”:1, “method”:”room/msg”, “params”:{ “id”:”100111″, “content”:{ “text”:”Hello world!” } } } Chat room members receive messages: { “jsonrpc”:”2.0″, “id”:1, “result”:{ “text”:”Hello world!” } } development: 1. Create a Controller in the websocket/controllers directory (or other paths, just modify the controllerNamespace configuration in config/main.php) […]

  • Talk about the MVC architecture of the PHP framework

    Time:2022-11-28

    foreword Before talking about the MVC architecture, let’s talk about the PHP framework. Many people who have learned the PHP language are faced with various PHP frameworks. What TP, Yii, CI, and the very popular laravel and so on. Most of them will say that they are based on the MVC architecture, and then you […]

  • php mongodb fuzzy search

    Time:2022-11-27

    I have been using the mysql database before, and I can get it done by fuzzy searching for like keywords. I recently connected to the mongodb platform, but I couldn’t adapt for a while, and stepped on some pitfalls. I will record it here, hoping to be useful to others. 1. How does mongodb perform […]