❝I have been thinking about backend globalization recently. The backend framework uses Layui. Let me briefly talk about the problem here!
❞
#I have been working for two years and I can only view technical documents if they are usable. I will read them after they are used. , I have never gone through the document in general.
In response to the recent questions, if I cannot say that I have read the ThinkPHP documentation carefully before, but I have probably never read it once, so the following questions have arisen.
The project needs to be globalized. The first thing to build is the backend. The backend is built by ThinkPHP, and the front-end UI framework uses layui.
The first problem encountered is how to achieve multi-language. The second problem I just encountered today is the multilingualization of Layui paging.
If you read the document early, you won’t waste so much time. TP's multi-language does not require us to do too much at all. After configuring the language package, we can use it directly using the lang helper function.
I hope everyone will not make the same mistake and read the technical documents you need when you have time or free time.
Regarding documentation, whether we are starting to learn or have used technology for a long time, we should read the documentation from beginning to end, so as not to waste some time when encountering new needs.
Take the TP framework used by Kaka as an example. Even if you read the directory once, too many things will happen later.
So I still hope that everyone can read more documents. It will only benefit you and not cause any harm.
This is the second question, for layui Pagination problem.
The requirement is to display the corresponding languages for different languages, and the language pack will not be mentioned.
When Kaka wrote this part of the program, the first idea was to directly search for the words of the previous page and the next page in the code.
The search found that it is in the js file of layui's page, and it is obfuscated code. Such code cannot be changed without even thinking about it.
If the developer wants you to customize your own requirements, why would they obfuscate the code? So Kaka started Baidu. After Baidu for a long time, I still couldn't find the answer, and I was silently thinking about it.
After suffering a loss from TP, I opened the source code of layui's framework. To be honest, Kaka didn't look at it seriously when he saw this, and he closed it directly.
The layui paging code looks like this. In fact, it is very obvious. Our count and limit are both returned by the background, so this prev can be customized! At this time, when returning to the layui document, the bright words "custom" are really dazzling.
I hope that after these two incidents, I can pay more attention to the documentation and be more rigorous in my own work. Learning styles and problem-solving efficiency.
❝Persistence in learning, persistence in blogging, and persistence in sharing are the beliefs that Kaka has always adhered to since his career. I hope that Kaka’s articles in Nuoda Internet can bring you Any help.
❞
The above is the detailed content of As programmers, have we carefully read the TP documentation?. For more information, please follow other related articles on the PHP Chinese website!