I originally learned the relevant knowledge of Yii1, although I half understood it, but the slight structure is Understood. Now I am using my evening time to learn how to use Yii2. I plan to build a backend management system. I will record it here to avoid forgetting it in the future.
I have read part of the authoritative guide of Yii2 so far. Although the Yiiframework Chinese website is authoritative, compared with the English version, some chapters are missing content, but I can still get a general understanding of what can be done. Please read it carefully when using a certain function. Of course, English is good It is recommended to read the English version, which is relatively new and comprehensive. By the way, I watched the "Stories to Tell with the Yii Framework" series of videos on MOOC.com, and they were very good.
What’s more important is that you need to use Google for FQ. After all, it is a foreign framework and there is relatively little content in Chinese. Most of the answers can be searched in Google. You can use XX-Net here. You can see how to use it yourself. Explain
The first is installation. The Yii2 advanced template is used here, and it is not recommended to use local. Now that you have composer, let’s learn new things:
1. Composer code repository, where you can find everything about Yii2. For example, enter "yiisoft/yii2-app-advanced" in the search box. This is the Yii2 advanced template we are looking for. This code base corresponds to github. You can check the github address in the upper right corner, and then check the instructions on how to install Yii2.
2. Download composer. Of course, due to the wall, composer may not work. You need to use Chinese images here. Some images have stopped updating. As of today (2016/03/27), the composer China full image is available. You should be able to use it according to the instructions.
After the above two components are configured, you should be able to use composer to download Yii2. Problems encountered during installation (under Windows system):
1. The following error will appear:
Fatal error: Call to undefined method Fxp\Composer\AssetPlugin\Package\Version\VersionParser::parseLinks<> ....
You can check this: https://github.com/yiisoft/yii2/issues/9794, that is, delete the "fxp" folder in the relevant directory, and then follow the steps again.
2. When installing under Windows, you may need to enter your github account password and token. This is to register a github account, and then go to "Personal Center"->"Settings"->"Personal access tokens" Just generate a token; if you encounter a situation where the 'git' command is not recognized, you need to download the github client and try it. If it doesn't work, you may need to add git to the environment variable
3. You may encounter this after the installation is complete:
<span>Invalid Parameter – yii\base\InvalidParamException The </span><span>file</span> or directory to be published does not exist: E:\www\yii2\yii2test1/vendor\bower/jquery/dist
This may be when you enter a sentence similar to the following:
composer global require <span>"</span><span>fxp/composer-asset-plugin:~1.1.1</span><span>"</span>
is incorrect, resulting in an incorrect directory location. One way is to re-enter the correct version above, and then
composer self-<span>update composer global update composer update</span>
Another method is that the currently required files are under vendorbowerbower-asset, so copying the following jquery file to the previous directory can run normally. But it is best to use the first method. I don’t know if the second method has any side effects.
The installation is basically like this. Although it is very laborious, it is also good to learn new methods. Anyway, if you encounter problems, just go to Baidu or Google. I don’t know the specific usage of composer, so I’ll search for it when I need it. That's it, let's go play ball first, Koko!