Php interview questions (1) supplement: & lt ;? Php/* // permission management of the database tries to write out the database design of a multi-user permission system, requiring the use of role assignment permissions, there are many-to-many management between users and roles. please write out the main tables and Fields. the multi-to-many relationship is too complicated. use two-to-many pairs to implement CREATETABLEt _ php interview questions (1)
Supplement:
/*
// Database permission management
Try to write out a database design for a multi-user permission system and require the use of roles to assign permissions,
Multi-to-many management between users and roles
Write out the main tables and fields
Multi-to-multi-relationship is too complex to implement with two multiple-to-one
Create table t_user (
Id int primary key,
Name varchar (20 ));
Create table t_role (
Id int primary key,
Name varchar (20 ));
Create table t_usersroles (
Id int primary key,
Userid int not null,
Roleid int not null );
// Two users and three roles
Insert into t_user VALUES (1, 'Tom ');
Insert into t_user VALUES (2, 'Jerry ');
Insert into t_role VALUES (1, 'admin ');
Insert into t_role VALUES (2, 'User ');
Insert into t_role VALUES (3, 'systemadmin ');
/Tom ---> admin systemadmin
Insert into t_usersroles VALUES (1, 1 );
Insert into t_usersroles VALUES (2, 1, 3 );
Insert into t_usersroles VALUES (3, 2, 2 );
*/
// ================================================ ====================
/*
* 1: mona1 mode: instantiate an object. in a system, only one object exists.
* The business class in the project is the list mode...
* Change newsService. php to mona1 mode.
*
* Design Mode: ----->
* Factory mode
* Abstract Factory mode
* Template Mode
* Decorator mode
* Facade mode
* Adapter mode
* Command mode
* Responsibility chain mode
*
* 2: session storage
* Multi-server session storage
* A: Put the session on the server.
* B: put the session in memcache.
*
*
// ================================================ ==========
Static webpage or image is always 200
304 is your own bandwidth savings
// ======================
A: The asort () function sorts the array and maintains the index relationship. (A-z)
It is mainly used to sort the arrays that are very important to the unit order.
The second optional parameter contains an additional sorting identifier.
Syntax
Asort (array, sorttype) parameter description
Array is required. Input array.
Sorttype is optional. Specifies how to arrange the values of an array. Possible values:
SORT_REGULAR-default. Process with their original type (without changing the type ).
SORT_NUMERIC-process the value as a number
SORT_STRING-process the value as a string
SORT_LOCALE_STRING-process the value as a string based on local settings *.
B: the sort () function sorts the values of a given array in ascending order. (A-z)
Note: This function assigns a new key name to the cell in the array. The original key name is deleted .! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
If the call succeeds, TRUE is returned. otherwise, FALSE is returned.
Syntax
Sort (array, sorttype) parameter description
Array is required. Input array.
Sorttype is optional. Specifies how to arrange the values of an array. Possible values:
SORT_REGULAR-default. Process with their original type (without changing the type ).
SORT_NUMERIC-process the value as a number
SORT_STRING-process the value as a string
SORT_LOCALE_STRING-process the value as a string based on local settings *.
C: The ksort () function sorts the array by key name and retains the original key for the array value .! ! ! ! ! ! ! ! ! ! ! ! ! ! !
The second optional parameter contains an additional sorting flag.
If yes, TRUE is returned. otherwise, FALSE is returned.
Syntax
Ksort (array, sorttype) parameter description
Array is required. Specifies the array to be sorted.
Sorttype is optional. Specifies how to arrange the values of an array. Possible values:
SORT_REGULAR-default. Process with their original type (without changing the type ).
SORT_NUMERIC-process the value as a number
SORT_STRING-process the value as a string
SORT_LOCALE_STRING-process the value as a string based on local settings *.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.