PHP? MySQL? ???? ??? ?? ?? ??
??? ??? ?? ??? ?? ??? ??? ???? ?? ???? ?? ??? ??????? ???? ????. ?? ??? ???? ?????. ??? ???? ??? ??? ?? ID? ????? 0?? ?? ???? ?? ??? ID? ?????.
?? ??? ????? ???? ?? ?? ?? ?? ???? ? ? ? ?? ??? ?????. ??? ?????. PHP? MySQL? ???? ? ??? ???? ??? ??? ????.
MySQL ??:
SELECT id, parent_id, name, link, position FROM menu_item ORDER BY parent_id, position;
? ??? ??-??? ???? ??? ??? ?? ?? ??? ?????. ??.
PHP ??:
<code class="php">$html = ''; $parent = 0; // Starting with the top-level menu $parent_stack = array(); // Keeps track of parent menu IDs // Map menu items by their parent ID $children = array(); foreach ($items as $item) { $children[$item['parent_id']][] = $item; } while ( // If there are more children at the current parent level ($option = each($children[$parent])) || // Or if we need to backtrack to a previous parent level ($parent > 0) ) { if (!empty($option)) { // Handle menu items with children if (!empty($children[$option['value']['id']])) { $html .= '<li>' . $option['value']['name'] . '</li>'; $html .= '<ul class="submenu">'; array_push($parent_stack, $parent); // Push current parent ID to the stack $parent = $option['value']['id']; // Set current parent to the current menu item's ID } // Handle menu items without children else { $html .= '<li>' . $option['value']['name'] . '</li>'; } } else { // Backtrack to the previous menu level $html .= '</ul>'; $parent = array_pop($parent_stack); // Pop the last parent ID from the stack } } // Output the resulting HTML echo $html;</code>
??:
- PHP ??? ?? ?? ID($parent_stack)? ???? ?? ??? ?????.
- ??-??? ???? ?? ??? ?????.
- ?? ??? ?? ??? ?? ?? ???
- ? ?? HTML ?? ??? ?? ?????. ?? ??? ??.
- ?? ?? ID? ??? ???? ?? ??? ?? ?? ??? ID? ?????.
- ?? ??? ?? ??? ??? ??? HTML ?? ????
- ? ?????.
- ?? ?? ??? ? ?? ?? ??? ??? ??? ?? ?? ?? ?? ?? ?? ??? ???? ??? ?? ?? ??? ?? ID? ?????.
- ?? ?? ??? ??? ??? ??? ?????.
? ?? ??? ???? ???? ??? ?????. ???? ??? ? ?? ?? ??? ?? ?? ?? ??? ??? ??? ?? ??? ?????.
? ??? PHP? MySQL? ???? ??? ?? ??? ???? ??: ??? ????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

MySQL ??????? ???? ?? ???? ??? ?? ? ?????? ???? ????. ?? MySQL -U ??? ?? -P? ???? ????? ???? ???? ??? ?????? ??????. ?? ??????? ???? ?? ??? ??? ????? -h ?? ??? ???????. ??, mysql-u username-p database name ?? mysql-u username-p database name? ?? ??? ? ? ?? ??????? ?? ????? ??? ? ? SQL ??? ??? ? ????.

?? ?? ? ?? ?? ??? ??? ??? ?????? ?? ??? ??? ?????? ??? ?????? ?????? ??? ?????. ? ?? ?? ???? ????. ??, ??????, ??? ? ??? ?? ??? UTF8MB4? ???? ???? ShowCreatedAtabase/Table? ???? ? Alter ??? ??????. ??, ?????? ??? ? UTF8MB4 ?? ??? ???? ?? ?? ??? ????? SetNames? ??????. ??, ?? ??? ????? ???? UTF8MB4_UNICODE_CI? ???? ?? ? ????? ???? ???? ?????? ???? ?? ? ? ?? ?? ??? ????? ??????.

MySQL? ???? ??? ???? InnoDB ?? ??? ???? ??? ???? ???? ?????. 1. ????? ??? SQL ?? ????, ?? ?? ?? ?? ??? ?????. 2. ? ???? ???, ???, ?? ? ???? ?????. 3. ????? ???? ????? ??? STARTTRANSACTION, CONMING ? ROLLBACK???. 4. 4 ?? ?? ???? ?? ??, ?? ? ??, ?? ??? ?? ? ???? ?????. 5. ????? ???? ???? ?? ??? ??? ?? ??? ?? ?? ? ??? ????? ??????. ??? ????? ?? MySQL? ?? ???? ?? ??? ?? ? ? ????.

MySQL? ?? ?? ? ???? ?? ??? ??? ??, ?? ?? ? ???? ??? ??? ? ?????. ??, ??? ??? UTF8MB4? ?? ?? ??? ?? ??? ?????. ?? ??? UTF8MB4_UNICODE_CI? ?? ?? ?? ??? ???? UTF8MB4_BIN? ?? ?????. ??, ?? ??? ?? ??? ??, ??????, ??? ? ??? ??? ? ????. ??? ??? ?? UTF8MB4 ? UTF8MB4_UNICODE_CI? ?? ? ???? ???? ?? ????. ??, ?? ??? ?? ??? ?? ???? ?? ??, ?? ?? ???? ??? ??? ?? ???? ???? ??? ???? ???? ???????. ?? ?? ??? ???? ?? ???? ? ??? ? ?? ??? ???????.

CTE? MySQL8.0?? ?? ? ???? ??? ??? ??? ? ?? ??? ??????. 1. CTE? ?? ?? ??? ?? ????? ???? ??? ??? ??? ?? ??? ?????. 2. ?? ??? ???? CTE? ? ?? ?? ??? ???? ????????. 3. ?? CTE? ?? ??? ?? ?? ? ???? ?? ? ? ?????, ?? ?? ?? ? ?? ??? ???????. 4. ?? ???? ?? ??, ?? ?? ??, ????? ?? ? ??? ??? ?????.

MySQL ?? ?? ???? ???? ??? ??, SQL ?? ???, ??? ?? ?? ? ???? ??, ?? ? ???? ?? ??? ???? ?? ??? ???????. 1. ??? ?? ????? : ????? ???? ?? ???? ?? ??, ?? ??? ??? ???, ?? ? ??? ?????? ????, ??? ??? ?? ???? ???? ???, ?? ???? ?????. 2. SQL ?? ??? : ??*? ???, ???? ??? ???? ??, ?? ?? ??? ???, ??? ?? ??? ???????. 3. ??? ?? ?? ? ???? : ?? ? ?? ????? ?? ???? ?? ?? ??? ????, ??? ?? ??? ????, ????? ???? ????, ?? ???? ???? ????? ???? ???? ?????. 4. ?? ? ???? ?? : Redis ??? ???? ?????? ??? ??? ?? ??? ???????.

??? ??? MySQL ?? ???? ????? 1. ?? RTO ? RPO ???? ????? ????? ?? ??? ?? ?? ? ??? ?? ??? ???? ?? ?? ? ??? ??????. 2. ?? ?? ? ?? ??? ??? ???? ?? ?? ?? (? : MySQLDump), ??? ?? (? : PerconaxTrabackup) ? Binlog (Binlog) ? Binlog (Binlog)? ???? ????? ?? ??? ?????. 3. ??? ??? ???? ?? ??? ??? ??? ?? ????? ????? ???????. 4. ?? ??? ????, ??? ??, ?? ?? ?? ? ?? ?? ????? ??? ???? ?????? ??????.

toptimizecomplexjoinoperationsinmysql, followfourkeysteps : 1) 1) ?? ComproperIndexingOnbothsidsidesofjoincolumns, ?? ComporIteIndexesFormulti-ColleumnJoinsandavoidinglargeVarCharIndexes; 2) ?? ? ?? ????
