【Foreword】
This article summarizes some of the problems encountered in the development process of ThinkPHP and takes notes. With the accumulation of knowledge, it will continue to improve in the future
【main body】
(1) Login status related
Description of the problem: In the OA system, I directly entered the URL and entered the background management system. When I am not logged in, I am ready to continue writing email-related functions. but found server error
Solve the problem:
The reason for the error is obviously that the condition of the query is wrong, and the id is empty. Next, I looked at the source code, here I set the id of the currently logged in user,
Because I am not logged in, it will report an error,
(2) Notes related
The position of the comment cannot be in the same line as the function definition, otherwise the browser will ignore the code block after the entire method by default when parsing
E.g:
//ajax request method function getMsgCount(){//Send ajax request // console.log('1') }
Here I wrote the comment after the method, the browser will automatically ignore the code block. As a result, the parsing fails. console error
Solution: delete the comment or wrap it in a new line .