I am a PHP development engineer, and the most skilled is the version 2.0 Yii framework. In the training class, the teacher didn’t teach me the Yii framework, but because my brother (peer) is good at the Yii framework, so I used the most Yii 2.0. I learned the 3.2 and 5.0 versions of ThinkPHP framework in the background. Although I was not proficient, I used them more or less. I used tp3.2 and 5.0 to make two RBAS with RBA C authority verification function (3.2 is auth) and basic add, delete, check and change function of the website background. As for yii2, over the past three years, I have used it to build multiple websites, such as my personal website.
Many PHP beginners don’t know which framework to choose for further learning. As far as I know, think PHP is the most widely used framework for PHP programmers in China, with versions 3.2 and 5.0 as representatives. At present, the mainstream PHP frameworks include ThinkPHP, Yii, lavavel, CI, etc. (ranking is not in any order, please don’t fight with their supporters). I know about both ThinkPHP and Yii framework, so I have some say. I think it’s better to be Yii. There are many advantages that ThinkPHP can’t match, such as GII that generates code automatically. That said, users of other frameworks may not be satisfied. They can say a lot about the advantages of their frameworks. Here I will not repeat, please Baidu yourself, so far.
1. From Yii official website https://www.yiichina.com Or other channels to download the advanced version (here take the advanced version as an example) to the PHP project root directory of your local computer. You can rename the downloaded folder.
2. If you are developing this website on your local computer (usually windows system), please double-click the init.bat The file completes the initialization of the project, and operates in the pop-up command interface. Select development locally, production online, enter the numbers representing them, press enter, enter yes, and press enter. In this way, the corresponding configuration files will be automatically generated under the web and config directories of frontend and backend, and the config directories of common and console. If you are uploading the project folder to the Linux system server,
3. Configure two local domain names with phpstudy: a foreground domain name points to frontend \ web under the project root directory, and a background domain name points to backend \ web under the project root directory.
4. Common / config / main under the root directory- local.php To configure the database information in the file, I suggest that you configure it as an online database (that is, you need to have a server or virtual cloud disk, but the code can be uploaded to the server instead of being uploaded locally). This is convenient to cooperate with version control (I use GIT). After doing some functions on the company’s computer every time, Before work, upload the code to code cloud or GitHub and other code hosting platforms. There is no need to upload the modified database file (because I forget to upload the database file many times, so I suggest putting the database online). When I get home and pull down the code, I can work at home and finish uploading the code.
5. Common / config / main under the root directory- local.php Configure the free email information in the file:
‘mailer’ => [
’class’ => ‘yii\swiftmailer\Mailer’,
’viewPath’ => ‘@common/mail’,
‘usefiletransport’ = > false, / / this sentence must have. False sends mail. True only generates mail in the runtime folder and does not send mail
’transport’ => [
’class’ => ‘Swift_SmtpTransport’,
’host’ => ‘ smtp.qq.com “, / / the host configuration of each mailbox is different. Take QQ mailbox as an example. For others, please use Baidu.
’username’ => ‘[email protected]’,
‘password’ = >.
’port’ => ‘465’,
’encryption’ => ‘ssl’,
6. Set common / config in the root directory/ params.php The values of adminemail and supportemail in the file are changed to your mailbox, such as the above [email protected]
1. Install adminlte in the background. Refer to: https://www.kancloud.cn/curder/yii/247760 。
To install adminlte V2, use CMD to invoke the command line tool and run:
composer require dmstr/yii2-adminlte-asset "^2.1"
To install adminlte V1, run:
Composer require dmstr / yii2 adminlte asset "^ 1" it is recommended to install the latest version.
If it’s too slow, consider domestic mirroring. The next step is to wait for the download. This process sometimes takes a long time, and there is no prompt in the command-line tool. Please be patient and don’t touch it.