Home >Backend Development >PHP Tutorial >Difficulties and miscellaneous diseases of ThinkPHP (5)

Difficulties and miscellaneous diseases of ThinkPHP (5)

WBOY
WBOYOriginal
2016-07-28 08:27:45985browse

<code>细节问题总是很多,想要更加优良的客户体验,必须吹毛求疵吧!
</code>

I encountered a small problem. How to realize that the initialized value of the select drop-down menu button is only displayed when it is loaded for the first time, and then it is still displayed in the drop-down menu but is not selectable?
 ThinkPHP之疑难杂症(五)

The effect here is selectable, if you want it it cannot be selected.
 ThinkPHP之疑难杂症(五)
Speaking of the function that cannot be selected, I need to add a disabled attribute to the <option> tag. However, after adding it directly, I found that the initialized default value cannot be displayed. This is not what I want, so I don’t know what to do. I was shocked...

My friend said it could be implemented using js, but he didn't know how to break it, and no one could help. So someone came up with the idea of ​​nesting an if statement, but not adding this attribute the first time, so——
 ThinkPHP之疑难杂症(五)
That's OK...

Then, comes the second functional question, how to implement fuzzy retrieval of menu names?

This is really stumping me... (It seems that every problem stumps me, and I ask netizens to solve it)

The initial idea is to add a search condition based on the original search function.
 ThinkPHP之疑难杂症(五)
Just add it at this location.

However, since I initially thought that the menu name I wanted to fuzzy search was a field name, the search could not be achieved using the syntax '%'.like.'%'. Then I thought about extracting the menu name into a parent table to implement the search function, but This shows my confusion, because the Menu table retrieved here is equivalent to a parent table, a menu management table, and the menu name here is the table content... And my mistake turned out to be...
 ThinkPHP之疑难杂症(五)
I wrote the wrong field name in the code related to this function from the front end to the backend. I wrote it as title. I thought it was right (not a mistake), and then I changed it to name and it was OK! ! !

Front-end code implementation
 ThinkPHP之疑难杂症(五)

Back-end code implementation
 ThinkPHP之疑难杂症(五)

The occurrence of this problem shows a very serious problem. If a developer is not familiar with the database, he will have a headache and all kinds of weird problems. People are exhausted -_-#

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the difficult and miscellaneous diseases of ThinkPHP (5), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn