php面试题 (一)

Jun 13, 2016 am 10:40 AM
insert sort

php面试题 (1)
补充:
/*
//数据库的权限管理
试写出一个多用户权限系统的数据库设计,要求使用角色分配权限,
用户和角色之间是多对多的管理
请写出主要的表和字段

多对多关系太过复杂 用2个多对一来实现

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);

//两个用户  三个角色
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,1);
INSERT INTO t_usersroles VALUES(2,1,3);
INSERT INTO t_usersroles VALUES(3,2,2);
*/
//====================================================
/*
*1:单子模式 :实例化一个对象 在一个系统里 只会有一个对象
*项目中 业务类---就是单子模式. . .
*newsService.php  修改成单子模式
*
*设计模式:::----->>
*工厂模式
*抽象工厂模式
*模板模式
*装饰器模式
*门面模式
*适配器模式
*命令模式
*职责链模式
*

*2:session 存储
*多服务器存储session
*a: 把session 放在服务器中
*b: session 放在memcache中
*
*
//===============================================
静态网页或者图片 一直是 200
304 是自己设置的  节省带宽

//==============
A:  asort() 函数对数组进行排序并保持索引关系。 (a-z)
主要用于对那些单元顺序很重要的结合数组进行排序。
可选的第二个参数包含了附加的排序标识。

语法
asort(array,sorttype)参数 描述
array 必需。输入的数组。
sorttype 可选。规定如何排列数组的值。可能的值:
SORT_REGULAR - 默认。以它们原来的类型进行处理(不改变类型)。
SORT_NUMERIC - 把值作为数字来处理
SORT_STRING - 把值作为字符串来处理
SORT_LOCALE_STRING - 把值作为字符串来处理,基于本地设置*。 

B:  sort() 函数按升序对给定数组的值排序。(a-z)
注释:本函数为数组中的单元赋予新的键名。原有的键名将被删除。! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
如果成功则返回 TRUE,否则返回 FALSE。

语法
sort(array,sorttype)参数 描述
array 必需。输入的数组。
sorttype 可选。规定如何排列数组的值。可能的值:
SORT_REGULAR - 默认。以它们原来的类型进行处理(不改变类型)。
SORT_NUMERIC - 把值作为数字来处理
SORT_STRING - 把值作为字符串来处理
SORT_LOCALE_STRING - 把值作为字符串来处理,基于本地设置*。

C:  ksort() 函数按照键名对数组排序,为数组值保留原来的键。! ! ! ! ! ! ! ! ! ! ! ! ! ! !
可选的第二个参数包含附加的排序标志。
若成功,则返回 TRUE,否则返回 FALSE。

语法
ksort(array,sorttype)参数 描述
array 必需。规定要排序的数组。
sorttype 可选。规定如何排列数组的值。可能的值:
SORT_REGULAR - 默认。以它们原来的类型进行处理(不改变类型)。
SORT_NUMERIC - 把值作为数字来处理
SORT_STRING - 把值作为字符串来处理
SORT_LOCALE_STRING - 把值作为字符串来处理,基于本地设置*。

//php页面静态化

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explore the underlying principles and algorithm selection of the C++sort function Explore the underlying principles and algorithm selection of the C++sort function Apr 02, 2024 pm 05:36 PM

The bottom layer of the C++sort function uses merge sort, its complexity is O(nlogn), and provides different sorting algorithm choices, including quick sort, heap sort and stable sort.

How to implement drag-and-drop sorting and drag-and-drop operations in uniapp How to implement drag-and-drop sorting and drag-and-drop operations in uniapp Oct 19, 2023 am 09:39 AM

Uniapp is a cross-platform development framework. Its powerful cross-end capabilities allow developers to develop various applications quickly and easily. It is also very simple to implement drag-and-drop sorting and drag-and-drop operations in Uniapp, and it can support drag-and-drop operations of a variety of components and elements. This article will introduce how to use Uniapp to implement drag-and-drop sorting and drag-and-drop operations, and provide specific code examples. The drag-and-drop sorting function is very common in many applications. For example, it can be used to implement drag-and-drop sorting of lists, drag-and-drop sorting of icons, etc. Below we list

What is the difference between insert ignore, insert and replace in mysql What is the difference between insert ignore, insert and replace in mysql May 29, 2023 pm 04:40 PM

The difference between insertignore, insert and replace instructions already exist or not. Example of insert error. Insertintonames(name,age)values("Xiao Ming", 23); insertignore ignores insertignoreintonames(name, age)values("Xiao Ming", 24); replace Replace and insert replaceintonames(name,age)values("Xiao Ming", 25); table requirements: PrimaryKey, or unique index result: the table id will be automatically incremented. Test code creates table

Sort array using Array.Sort function in C# Sort array using Array.Sort function in C# Nov 18, 2023 am 10:37 AM

Title: Example of using the Array.Sort function to sort an array in C# Text: In C#, array is a commonly used data structure, and it is often necessary to sort the array. C# provides the Array class, which has the Sort method to conveniently sort arrays. This article will demonstrate how to use the Array.Sort function in C# to sort an array and provide specific code examples. First, we need to understand the basic usage of the Array.Sort function. Array.So

Use java's StringBuilder.insert() function to insert a string at the specified position Use java's StringBuilder.insert() function to insert a string at the specified position Jul 24, 2023 pm 09:37 PM

Use java's StringBuilder.insert() function to insert a string at a specified position. StringBuilder is a class in Java used to handle variable strings. It provides a variety of methods to operate strings. The insert() function is used to insert strings at specified positions. One of the common methods of positionally inserting strings. In this article, we will introduce how to use the insert() function to insert a string at a specified position and give corresponding code examples. insert()

How to add, edit and delete table rows in jQuery? How to add, edit and delete table rows in jQuery? Sep 05, 2023 pm 09:49 PM

In today's era of web development, effective and efficient table management has become very important, especially when dealing with data-heavy web applications. The ability to dynamically add, edit, and delete rows from a table can significantly enhance the user experience and make applications more interactive. An effective way to achieve this is to leverage the power of jQuery. jQuery provides many features to help developers perform operations. Table rows A table row is a collection of interrelated data, represented by elements in HTML. It is used to group together cells (represented by elements) in a table. Each element is used to define a row in the table, and for multi-attribute tables, it usually contains one or more elements. Syntax$(selector).append(co

Why doesn't list.sort() return a sorted list in Python? Why doesn't list.sort() return a sorted list in Python? Sep 18, 2023 am 09:29 AM

Example In this example, we first look at the usage of list.sort() before continuing. Here, we have created a list and sorted it in ascending order using sort() method - #CreatingaListmyList=["Jacob","Harry","Mark","Anthony"]#DisplayingtheListprint("List=",myList)#SorttheListsinAscendingOrdermyList .sort(

How to sort a list using List.Sort function in C# How to sort a list using List.Sort function in C# Nov 17, 2023 am 10:58 AM

How to sort a list using the List.Sort function in C# In the C# programming language, we often need to sort the list. The Sort function of the List class is a powerful tool designed for this purpose. This article will introduce how to use the List.Sort function in C# to sort a list, and provide specific code examples to help readers better understand and apply this function. The List.Sort function is a member function of the List class, used to sort elements in the list. This function receives

See all articles