tp使用php scandir 乱码函数 文件会出现乱码吗

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)一、PHP核心技术
1.写出一个能创建多级目录的PHP函数(新浪网技术部)
2.写出smarty模板的特点(新浪网技术部)
速度快,编译型,缓存技术,插件机制,强大的表现逻辑
3.打开php.ini中的safe_mode,会影响哪些函数?至少说出6个。(新浪)
safe_mode,安全模式,它提供一个基本安全的共享环境,在一个有多个用户账户存在的php开发的web服务器上。当安全模式打开的时候,一些函数将被完全的禁止,而另一些函数的功能将会受到限制,如:chdir,move_uploaded_file,chgrp,parse_ini_file,chown,rmdir,copy,rename,fopen,require,mkdir,unlink等。注意,在php5.3以上版本,safe_mode被弃用,在php5.4以上版本,则将此特性完全去除了。
4.抓取远程图片到本地,你会用什么函数?(51.com笔试题)
file_get_contents或者curl
5.PHP的垃圾收集机制是怎样的(腾讯)
PHP可以自动进行内存管理,清除不再需要的对象。PHP使用了引用计数(reference counting)这种单纯的垃圾回收(garbage collection)机制。每个对象都内含一个引用计数器,每个reference连接到对象,计数器加1。当reference离开生存空间或被设为NULL,计数器减1。当某个对象的引用计数器为零时,PHP知道你将不再需要使用这个对象,释放其所占的内存空间。
6.请写一段PHP代码,确保多个进程同时写入同一个文件成功(腾讯)
核心思路:加锁
$fp = fopen("lock.txt","w+");
if (flock($fp,LOCK_EX)) {
7.写一个函数,尽可能高效的,从一个标准url里取出文件的扩展名,例如:)
相关题目:使用五种以上方式获取一个文件的扩展名,要求:dir/upload.image.jpg,找出.jpg或者jpg,必须使用PHP自带的处理函数进行处理,方法不能明显重复,可以封装成函数,比如get_ext1(filename),getext2(file_name)
8.写一个函数,能够遍历一个文件夹下的所有文件和子文件夹。(新浪)
function my_scandir($dir){
$files = array();
if(is_dir($dir)){
if ($handle = opendir($dir)) {
while (($flie = readdir($handle))!== false) {
if ($flie!="." && $file!="..") {
if (is_dir($dir."/".$file)) {
$files[$file] = my_scandir($dir."/".$file);
$files[] = $dir."/".$
closedir($handle);
[!!!]9.简述论坛中无限分类的实现原理。(新浪)
创建类别表如下:
CREATE TABLE category(
cat_id smallint unsigned not null auto_increment primary key comment'类别ID',
cat_name VARCHAR(30)NOT NULL DEFAULT''COMMENT'类别名称',
parent_id SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT'类别父ID'
)engine=MyISAM charset=utf8;
编写一个函数,递归遍历,实现无限分类
function tree($arr,$pid=0,$level=0){
static $list = array();
foreach ($arr as $v) {
10.写一个函数,算出两个文件的相对路径,如a=′/a/b/c/d/e.php′;b='/a/b/12/34/c.php';计算出b相对于a的相对路径应该是../../c/d(新浪)
function releative_path($path1,$path2){
$arr1 = explode("/",dirname($path1));
$arr2 = explode("/",dirname($path2));
for ($i=0,$len = count($arr2); $i & $ $i++) {
if ($arr1[$i]!=$arr2[$i]) {
11.mysql_fetch_row()和mysql_fetch_array()有什么分别?
mysql_fetch_row()把的一列储存在一个以零为基数的数组中,第一栏在数组的索引0,第二栏在索引1,依此类推。mysql_fetch_assoc()把数据库的一列储存在一个关联数组中,数组的索引就是字段名称,例如我的数据库查询送回“first_name”、“last_name”、“email”三个字段,数组的索引便是“first_name”、“last_name”和“email”。mysql_fetch_array()可以同时送回mysql_fetch_row()和mysql_fetch_assoc()的值。
12.有一个网页地址,比如PHP开发资源网主页:?
方法1(对于PHP5及更高版本):
$readcontents=fopen("http://www.phpres.com/index.html","rb");
$contents=stream_get_contents($readcontents);
fclose($readcontents);
echo file_get_contents("http://www.phpres.com/index.html");
13.谈谈对mvc的认识
由模型(model),视图(view),控制器(controller)完成的应用程序。model层负责提供数据,和数据库有关的操作都交给模型层来处理,view层则提供交互的界面,并输出数据,而controller层则负责接收请求,并分发给相应的model来处理,然后调用view层来显示。
[!]14.What does the GD library do?(Yahoo)
GD库提供了一系列用来处理图片的API,使用GD库可以处理图片,或者生成图片。在网站上GD库通常用来生成缩略图或者用来对图片加水印或者对网站数据生成报表。自从PHP 4.3.0版本后GD便内建在PHP系统中。
15.What function can you use to open a file for reading and writing?(Yahoo)
A.fget();B.file_open();C.fopen();D.open_file();答案:Cfget()这不是一个PHP函数,会引致执行错误。file_open()这不是一个PHP函数,会引致执行错误。fopen()这是正确答案,fopen()可以用来开启档案以便读写。open_file()这不是一个PHP函数,会引致执行错误。
[!!]16.Smarty的原理
smarty是一个模板引擎,使用smarty主要是为了实现逻辑和外在内容的分离,如果不使用模板的话,通常的做法就是php代码和html代码混编。使用了模板之后,则可以将业务逻辑都放到php文件中,而负责显示内容的模板则放到html文件中。Smarty在执行display方法的时候,读取模板文件,并进行数据替换,生成编译文件,之后每次访问都会直接访问编译文件,读取编译文件省去了读取模板文件,和字符串替换的时间,所以可以更快,编译文件里时间戳记录模板文件修改时间,如果模板被修改过就可以检测到,然后重新编译(编译是把静态内容保存起来,动态内容根据传入的参数不同而不同)。如果启用了缓存,则会根据编译文件生成缓存文件,在访问的时候如果有缓存文件并且缓存文件没有过期,则直接访问缓存文件。
相关题目1:能够使HTML和PHP分离开使用的模板
smarty,phplib等
相关题目2:您是否用过模板引擎?如果有您用的模板引擎的名字是?
17.PHP如何实现页面跳转
方法一:php函数跳转,缺点,header头之前不能有输出,跳转后的程序继续执行,可用exit中断执行后面的程序。header("Location:网址");//直接跳转header("refresh:3;url=http://axgle.za");//三秒后跳转
方法二:利用metaecho"&meta http-equiv=refresh content='0;url=网址'&";
18.PHP可以和sql server/oracle等数据库连接吗?
19.使用哪些工具进行版本控制?
SVN或者CVS
相关题目:您是否用过版本控制软件?如果有您用的版本控制软件的名字是?
TortoiseSVN-1.2.6
20.写出一个正则表达式,过虑网页上的所有JS/VBS脚本(即把script标记及其内容都去掉):
过滤脚本参考:
header("content-type:text/charset=utf-8");
$script = "以下内容不显示:&script type='text/javascript'&alert('cc');&/script&";
$pattern = '/&script[^&]*?&.*?&/script&/si';
echo preg_replace($pattern, "脚本内容", $script);
方案一,使用PHP内建函数strip_tags()除去HTML标签方案二,自定义函数,如下:
header("content-type:text/charset=utf-8");
function strip_html_tags($str){
$pattern = '/&("[^"]*"|\'[^\']\*\'|[^&"\'])*&/';
return preg_replace($pattern,'',$str);
22.请写一个函数验证电子邮件的格式是否正确(要求使用正则)(新浪)
preg_match('/^[\w\-\.]+@[\w\-]+(\.\w+)+$/',$email);
相关题目:请用正则表达式写一个函数,验证电子邮件的格式是否正确。(鑫众人云)
23.请对POSIX风格和兼容Perl风格两种正则表达式的主要函数进行类比说明(腾讯)
主要区别有以下三种:
preg_replace()里面的正则可以写成型如:"/.xxx/"而ereg_replace()里面的正则需写成型如 "xxx"
preg_replace()能操作数组,而ereg_replace()不可以
在逆向引用用preg_replace()可使用0-99个,而ereg_replace()最多为9个
使用Perl兼容正则表达式语法的preg_match()函数通常是比ereg()更快的替代方案。
24.请写出并说明如何在命令行下运行PHP脚本(写出两种方式)同时向PHP脚本传递参数?(腾讯)
首先进入php安装目录php -f d:/wamp/www/1.php 其中-f参数指定要执行的php文件php -r phpinfo(); 其中-r表示直接执行php代码,无需写开始结束标记
25.使用正则表达式提取一段标识语言(html或xml)代码段中指定标签的指定属性值(需考虑属性值对不规则的情况,如大小写不敏感,属性名值与等号间有空格等)。此处假设需提取test标签的attr属性值,请自行构建包含该标签的串(腾讯)
编写如下函数:
header("content-type:text/charset=utf-8");
function getAttrValue($str,$tagName,$attrName){
$pattern1="/&".$tagName."(\\s+\\w+\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\2))*\\s+".$attrName."\\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\5)(\\s+\\w+\\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\9))*\\s*&/i";
$arr=array();
$re=preg_match($pattern1,$str,$arr);
echo"&br/&\$arr[6]={$arr[6]}";
echo"&br/&没找到。";
这是把一个日期从MM/DD/YYYY的格式转为DD/MM/YYYY格式。输出26/08/2003
27.What function would you use to redirect the browser to a new page?(Yahoo)
A.redir()B.header()C.location()D.redirect()答案:Bredir()这不是一个PHP函数,会引致执行错误。header()这个是正确答案,header()函数发送头信息,可以用来使浏览器转向到另一个页面,例如:header("Location:")。location()这不是一个PHP函数,会引致执行错误。redirect()这不是一个PHP函数,会引致执行错误。
28.When turned on____________will_________your script with different variables fromHTML forms and cookies.(腾讯)A.show_errors,enableB.show_errors,showC.register_globals,enhanceD.register_globals,inject答案:C
29.一个函数的参数不能是对变量的引用,除非在php.ini中把____设为on。allow_call_time_pass_reference是否启用在函数调用时强制参数被按照引用传递
30.在HTML语言中,页面头部的meta标记可以用来输出文件的编码格式,以下是一个标准的meta语句&META http-equiv='Content-Type'content='text/charset=gbk'&,请使用PHP语言写一个函数,把一个标准HTML页面???的类似meta标记中的charset部分值改为big5。(新浪)
请注意:(1)需要处理完整的html页面,即不光此meta语句(2)忽略大小写(3)'和"在此处是可以互换的(4)'Content-Type'两侧的引号是可以忽略的,但'text/charset=gbk'两侧的不行(5)注意处理多余空格编写正则表达式如下:$reg1="/(&meta\\s*http-equiv\\s*=\\s*(['\"]?)Content-Type(\\2)\\s*content\\s*=\\s*(['\"])text\/charset=)(UTF-8)(\\4)(\\s*\/?&)/i";
<h6 id="php-.PHP中如何判断一个字符串是否是合法的日期模式: 13:13:13。要求代码不超过5行。(酷讯)
function checkDateTime($data){
if (date('Y-m-d H:i:s',strtotime($data)) == $data) {
32.PHP中,如何获得一个数组的键值?(酷讯)
使用key()可以获得数组中当前元素的键名,使用current()则可以返回当前元素的值。使用array_keys()则可以得到数组中所有的键名。使用foreach结构foreach($arr as&key=&value)可以通过key和value分别获取键名和值。
33.如果模板是用smarty模板。怎样用section语句来显示一个名为$data的组。比如:
$data=array(
0=&array('id'=&8,'name'=&'name1'),
1=&array('id'=&10,'name'=&'name2'),
2=&array('id'=&15,'name'=&'name3')
写出在模板页的代码?若用foreach语句又要怎样显示呢?
用section语句:
用foreach语句:
34.哪个选项会匹配下边的这个正则表达式?(/.*xyz\d/)A.*****xyz
B.*****xyz1C.******xyz2D.*xyz答案:C
35.以下哪个错误无法被标准的错误控制器获取?
A.E_WARNINGB.E_USER_ERRORC.E_PARSED.E_NOTICE答案:B
36.以下哪种错误类型无法被自定义的错误处理器捕捉到?(奇矩互动)
A.E_WARNINGB.E_USER_ERRORC.E_PARSED.E_NOTICE答案:C
37.(^\s)|(\s$)这个正则表达式作用是:__________;
匹配以0个或多个空白符开头或者0个或多个空白符结尾的字符串
38.编写函数取得上一月的最后一天
date_default_timezone_set('PRC');
39.在很多时候,我们可以通过apache的主配置文件来设置对test目录的访问权限控制,如http://IP/test请问如果需设置test下的一个子目录的访问控制权限,是否可以在主配置文件中修改,如果不可以应如何解决。
可以,还可以在需要控制的子目录下创建.htaccess文件,写入访问控制。
40.如果我的网站用的utf-8编码,为防止乱码出现,都需要注意哪些地方?
从以下几个方面考虑:
数据库中库和表都用utf8编码
php连接mysql,指定数据库编码为utf8&mysql_query(“set names utf8”);
php文件指定头部编码为utf-8header(“content-type:text/charset=utf-8”);
网站下所有文件的编码为utf8
html文件指定编码为utf-8&meta http-equiv="Content-Type"content="text/charset=utf-8"/&
41.在url中用get传值的时候,若中文出现乱码,应该用哪个函数对中文进行编码?
urlencode()
42.写出两种对变量加密的函数?
md5(str);sha1(str);
43.如何把 10:30:25变成unix时间戳?
date_default_timezone_set("PRC");
44.如何把一个GB2312格式的字符串装换成UTF-8格式?
iconv('GB2312','UTF-8','悄悄是别离的笙箫');
45.如果需要原样输出用户输入的内容,在数据入库前,要用哪个函数处理?
htmlspecialchars或者htmlentities
46.写出五种以上你使用过的PHP的扩展的名称(提示:常用的PHP扩展)
mb_sring、iconv、curl、GD、XML、socket、、PDO等
47.了解MVC模式吗?请写出三种以上目前PHP流行的MVC框架名称(不区分大小写)
FleaPHP、Zend Framework、CakePHP、Symfony、ThinkPHP、YII、CodeIgniter等
48.php中WEB上传文件的原理是什么,如何限制上传文件的大小?
上传文件的表单使用post方式,并且要在form中添加enctype='multipart/form-data'。一般可以加上隐藏域:&input type=hidden name='MAX_FILE_SIZE' value=dddddd&,位置在file域前面。value的值是上传文件的客户端字节限制。可以避免用户在花时间等待上传大文件之后才发现文件过大上传失败的麻烦。使用file文件域来选择要上传的文件,当点击提交按钮之后,文件会被上传到服务器中的临时目录,在脚本运行结束时会被销毁,所以应该在脚本结束之前,将其移动到服务器上的某个目录下,可以通过函数move_uploaded_file()来移动临时文件,要获取临时文件的信息,使用$_FILES。
限制上传文件大小的因素有:
客户端的隐藏域MAX_FILE_SIZE的数值(可以被绕开)。
服务器端的upload_max_filesize,post_max_size和memory_limit。这几项不能够用脚本来设置。
自定义文件大小限制逻辑。即使服务器的限制是能自己决定,也会有需要个别考虑的情况。所以这个限制方式经常是必要的。
49.简述UBB code的实现原理。(YG)
UBB代码是HTML的一个变种,通过程序自定义我们的标签,比如“[a]PHP中UBB的使用[/a]”这样的标签,其实质就是查找[a][/a]标签,将其替换成的标准html,说白了,就是将标准的html标记通过技术手段使其简化,其输出出来的结果还是标准的html。明白了ubb的原理,那么再制作一个简单的ubb编辑器就不难了,和fck之类的编辑器比较起来,ubb代码最大的优点就是代码简单,功能很少,简单的ubb只需要一个文件,而且ubb标签可以自己来定义,更改起来很方便,在php中就是利用替换函数就可以将html进行标签化,输出时进行标签的转化。
50.怎么把文件保存到指定目录?怎么避免上传文件重名问题?
可以自己设置上传文件的保存目录,与文件名拼凑形成一个文件路径,使用move_uploaded_file(),就可以完成将文件保存到指定目录。可以通过上传的文件名获取到文件后缀,然后使用时间戳+随机数+文件后缀的方式为文件重新命名,这样就避免了重名。
51._____函数能返回脚本里的任意行中调用的函数的名称。该函数同时还经常被用在调试中,用来判断错误是如何发生的。(奇矩互动)
debug_print_backtrace()
52.在Smarty模板语法中怎么能遍历数组a=array(array(′id′=&0),array(′id′=&1),array(′id′=&2),……)id=&0-10000,怎么判断当id=&500,让输出的值在HTML里变为红色?(亿邮)设数组分配过来的数组名为ids
{section name=temp loop=$ids}
{if $ids[temp].id==500}
&span style=‘color:
53.在Smarty模板语法中如何获取当前时间,并且使用Y-m-d H:i:s的格式输出?(亿邮)
使用{$smarty.now}来获取当前时间,得到的是unix系统时间戳使用变量调节器进行格式化,如下:{$smarty.now|date_format:“%Y-%m-%d%H:%M:%S”}
54.在Smarty模板语法中如何获取php的全局环境变量(亿邮)
$smarty.get.变量 #显示通过get方式传过来的指定变量的值$smarty.post.变量 #显示通过post方式传过来的指定变量的值$smarty.cookies.变量 #显示通过cookie中指定变量的值$smarty.server.SERVER_NAME #显示server变量值,$_SERVER系列变量$smarty.env.PATH #显示系统环境变量值,$_ENV系列变量$smarty.session.变量 #显示session中指定变量的值$smarty.request.变量 #显示通过post、get、cookie中指定变量的值
55.在Smarty模板中如何用自定义函数(亿邮)
使用模板分隔符包含,传递参数则使用HTML属性的方式,例如:{html_image file="pumpkin.jpg"}
56.列举出你所知道的php系统函数库例如,数学函数库(亿邮)
mysql,gd,pdo,XML,zip,filesystem,mail等
57.假如让你来写一个函数实现Utf-8转gb2312,那么函数的名称应该怎么命名?(亿邮)
utf8_to_gb2312或者utf8togb2312
58.请描述如下URL重写规则的用意。(卓望)
&IfModulemod_rewrite.c&
RewriteEngineon
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteBase/
RewriteRule./index.php[L]
&/IfModule&
如果REQUEST_FILENAME文件存在,就直接访问文件,不进行下面的rewrite规则,如果REQUEST_FILENAME目录存在,就直接访问目录,不进行下面的rewrite规则,RewriteRule./index.php[L]的意思是把所有的请求都给index.php处理。
一般是在heade
一、PHP核心技术
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出一个能创建多级目录的PHP函数(新浪网技术部)
$path string 要创建的目录
$mode int 创建目录的模式,在windows下可忽略
function create_dir($path,$mode = 0777)
if (is_dir($path)) {
echo "该目录已经存在";
if (mkdir($path,$mode,true)) {
echo "创建目录成功";
echo "创建目录失败";
<h6 id="smarty" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出smarty模板的特点(新浪网技术部)
速度快,编译型,缓存技术,插件机制,强大的表现逻辑
<h6 id="php.inisafe_mode6" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.打开php.ini中的safe_mode,会影响哪些函数?至少说出6个。(新浪)
safe_mode,安全模式,它提供一个基本安全的共享环境,在一个有多个用户账户存在的php开发的web服务器上。当安全模式打开的时候,一些函数将被完全的禁止,而另一些函数的功能将会受到限制,如:chdir,move_uploaded_file,chgrp,parse_ini_file,chown,rmdir,copy,rename,fopen,require,mkdir,unlink等。注意,在php5.3以上版本,safe_mode被弃用,在php5.4以上版本,则将此特性完全去除了。
<h6 id="51.com" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.抓取远程图片到本地,你会用什么函数?(51.com笔试题)
file_get_contents或者curl
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP的垃圾收集机制是怎样的(腾讯)
PHP可以自动进行内存管理,清除不再需要的对象。PHP使用了引用计数(reference counting)这种单纯的垃圾回收(garbage collection)机制。每个对象都内含一个引用计数器,每个reference连接到对象,计数器加1。当reference离开生存空间或被设为NULL,计数器减1。当某个对象的引用计数器为零时,PHP知道你将不再需要使用这个对象,释放其所占的内存空间。
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请写一段PHP代码,确保多个进程同时写入同一个文件成功(腾讯)
核心思路:加锁
$fp = fopen("lock.txt","w+");
if (flock($fp,LOCK_EX)) {
fwrite($fp, "write something");
flock($fp, LOCK_UN);
echo "file is locking...";
fclose($fp);
<h6 id="urlhttpwww.sina.com.cnabcdefg.phpid1php.php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写一个函数,尽可能高效的,从一个标准url里取出文件的扩展名,例如:)
function getExt1($url){
$arr = parse_url($url);
$file = basename($arr['path']);
$ext = explode('.', $file);
return $ext[count($ext)-1];
function getExt2($url){
$url = basename($url);
$pos1 = strpos($url,'.');
$pos2 = strpos($url,'?');
if (strstr($url,'?')) {
return substr($url,$pos1+1,$pos2-$pos1-1);
return substr($url,$pos1);
$path = "http://www.sina.com.cn/abc/de/fg.php?id=1";
echo getExt1($path);
echo "&br /&";
echo getExt2($path);
相关题目:使用五种以上方式获取一个文件的扩展名,要求:dir/upload.image.jpg,找出.jpg或者jpg,必须使用PHP自带的处理函数进行处理,方法不能明显重复,可以封装成函数,比如get_ext1(filename),getext2(file_name)
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写一个函数,能够遍历一个文件夹下的所有文件和子文件夹。(新浪)
function my_scandir($dir){
$files = array();
if(is_dir($dir)){
if ($handle = opendir($dir)) {
while (($flie = readdir($handle))!== false) {
if ($flie!="." && $file!="..") {
if (is_dir($dir."/".$file)) {
$files[$file] = my_scandir($dir."/".$file);
$files[] = $dir."/".$
closedir($handle);
[!!!]9.简述论坛中无限分类的实现原理。(新浪)
创建类别表如下:
CREATE TABLE category(
cat_id smallint unsigned not null auto_increment primary key comment'类别ID',
cat_name VARCHAR(30)NOT NULL DEFAULT''COMMENT'类别名称',
parent_id SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT'类别父ID'
)engine=MyISAM charset=utf8;
编写一个函数,递归遍历,实现无限分类
function tree($arr,$pid=0,$level=0){
static $list = array();
foreach ($arr as $v) {
if ($v['parent_id'] == $pid) {
$v['level'] = $
$list[] = $v;
tree($arr,$v['cat_id'],$level+1);
<h6 id="aabcde.phpbab1234c.phpba....cd" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写一个函数,算出两个文件的相对路径,如a=′/a/b/c/d/e.php′;b='/a/b/12/34/c.php';计算出b相对于a的相对路径应该是../../c/d(新浪)
function releative_path($path1,$path2){
$arr1 = explode("/",dirname($path1));
$arr2 = explode("/",dirname($path2));
for ($i=0,$len = count($arr2); $i & $ $i++) {
if ($arr1[$i]!=$arr2[$i]) {
if ($i==1) {
$return_path = array();
if ($i != 1 && $i & $len) {
$return_path = array_fill(0, $len - $i,"..");
if ($i == $len) {
$return_path = array('./');
$return_path = array_merge($return_path,array_slice($arr1,$i));
return implode('/',$return_path);
$a = '/a/b/c/d/e.php';
$b = '/a/b/12/34/c.php';
$c = '/e/b/c/d/f.php';
$d = '/a/b/c/d/g.php';
echo releative_path($a,$b);
echo "&br /&";
echo releative_path($a,$c);
echo "&br /&";
echo releative_path($a,$d);
echo "&br /&";
<h6 id="mysql_fetch_rowmysql_fetch_array" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.mysql_fetch_row()和mysql_fetch_array()有什么分别?
mysql_fetch_row()把的一列储存在一个以零为基数的数组中,第一栏在数组的索引0,第二栏在索引1,依此类推。mysql_fetch_assoc()把数据库的一列储存在一个关联数组中,数组的索引就是字段名称,例如我的数据库查询送回“first_name”、“last_name”、“email”三个字段,数组的索引便是“first_name”、“last_name”和“email”。mysql_fetch_array()可以同时送回mysql_fetch_row()和mysql_fetch_assoc()的值。
<h6 id="phphttpwww.phpres.comindex.html" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.有一个网页地址,比如PHP开发资源网主页:?
方法1(对于PHP5及更高版本):
$readcontents=fopen("http://www.phpres.com/index.html","rb");
$contents=stream_get_contents($readcontents);
fclose($readcontents);
echo $contents;
echo file_get_contents("http://www.phpres.com/index.html");
<h6 id="mvc" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.谈谈对mvc的认识
由模型(model),视图(view),控制器(controller)完成的应用程序。model层负责提供数据,和数据库有关的操作都交给模型层来处理,view层则提供交互的界面,并输出数据,而controller层则负责接收请求,并分发给相应的model来处理,然后调用view层来显示。
[!]14.What does the GD library do?(Yahoo)
GD库提供了一系列用来处理图片的API,使用GD库可以处理图片,或者生成图片。在网站上GD库通常用来生成缩略图或者用来对图片加水印或者对网站数据生成报表。自从PHP 4.3.0版本后GD便内建在PHP系统中。
<h6 id="what-function-can-you-use-to-open-a-file-for-reading-and-writingyahoo" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.What function can you use to open a file for reading and writing?(Yahoo)
A.fget();B.file_open();C.fopen();D.open_file();答案:Cfget()这不是一个PHP函数,会引致执行错误。file_open()这不是一个PHP函数,会引致执行错误。fopen()这是正确答案,fopen()可以用来开启档案以便读写。open_file()这不是一个PHP函数,会引致执行错误。
[!!]16.Smarty的原理
smarty是一个模板引擎,使用smarty主要是为了实现逻辑和外在内容的分离,如果不使用模板的话,通常的做法就是php代码和html代码混编。使用了模板之后,则可以将业务逻辑都放到php文件中,而负责显示内容的模板则放到html文件中。Smarty在执行display方法的时候,读取模板文件,并进行数据替换,生成编译文件,之后每次访问都会直接访问编译文件,读取编译文件省去了读取模板文件,和字符串替换的时间,所以可以更快,编译文件里时间戳记录模板文件修改时间,如果模板被修改过就可以检测到,然后重新编译(编译是把静态内容保存起来,动态内容根据传入的参数不同而不同)。如果启用了缓存,则会根据编译文件生成缓存文件,在访问的时候如果有缓存文件并且缓存文件没有过期,则直接访问缓存文件。
相关题目1:能够使HTML和PHP分离开使用的模板
smarty,phplib等
相关题目2:您是否用过模板引擎?如果有您用的模板引擎的名字是?
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP如何实现页面跳转
方法一:php函数跳转,缺点,header头之前不能有输出,跳转后的程序继续执行,可用exit中断执行后面的程序。header("Location:网址");//直接跳转header("refresh:3;url=http://axgle.za");//三秒后跳转
方法二:利用metaecho"&meta http-equiv=refresh content='0;url=网址'&";
<h6 id="phpsql-serveroracle" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP可以和sql server/oracle等数据库连接吗?
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.使用哪些工具进行版本控制?
SVN或者CVS
相关题目:您是否用过版本控制软件?如果有您用的版本控制软件的名字是?
TortoiseSVN-1.2.6
<h6 id="jsvbsscript" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出一个正则表达式,过虑网页上的所有JS/VBS脚本(即把script标记及其内容都去掉):
过滤脚本参考:
header("content-type:text/charset=utf-8");
$script = "以下内容不显示:&script type='text/javascript'&alert('cc');&/script&";
$pattern = '/&script[^&]*?&.*?&/script&/si';
echo preg_replace($pattern, "脚本内容", $script);
方案一,使用PHP内建函数strip_tags()除去HTML标签方案二,自定义函数,如下:
header("content-type:text/charset=utf-8");
function strip_html_tags($str){
$pattern = '/&("[^"]*"|\'[^\']\*\'|[^&"\'])*&/';
return preg_replace($pattern,'',$str);
$html = '&p id=""&ddddd&br /&&/p&';
echo strip_html_tags($html);
echo "&br /&";
$html = '&p id="&"&bb&br /&aaa&br /&&/p&';
echo strip_html_tags($html);
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请写一个函数验证电子邮件的格式是否正确(要求使用正则)(新浪)
preg_match('/^[\w\-\.]+@[\w\-]+(\.\w+)+$/',$email);
相关题目:请用正则表达式写一个函数,验证电子邮件的格式是否正确。(鑫众人云)
<h6 id="posixperl" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请对POSIX风格和兼容Perl风格两种正则表达式的主要函数进行类比说明(腾讯)
主要区别有以下三种:
preg_replace()里面的正则可以写成型如:"/.xxx/"而ereg_replace()里面的正则需写成型如 "xxx"
preg_replace()能操作数组,而ereg_replace()不可以
在逆向引用用preg_replace()可使用0-99个,而ereg_replace()最多为9个
使用Perl兼容正则表达式语法的preg_match()函数通常是比ereg()更快的替代方案。
<h6 id="phpphp" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请写出并说明如何在命令行下运行PHP脚本(写出两种方式)同时向PHP脚本传递参数?(腾讯)
首先进入php安装目录php -f d:/wamp/www/1.php 其中-f参数指定要执行的php文件php -r phpinfo(); 其中-r表示直接执行php代码,无需写开始结束标记
<h6 id="htmlxmltestattr" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.使用正则表达式提取一段标识语言(html或xml)代码段中指定标签的指定属性值(需考虑属性值对不规则的情况,如大小写不敏感,属性名值与等号间有空格等)。此处假设需提取test标签的attr属性值,请自行构建包含该标签的串(腾讯)
编写如下函数:
header("content-type:text/charset=utf-8");
function getAttrValue($str,$tagName,$attrName){
$pattern1="/&".$tagName."(\\s+\\w+\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\2))*\\s+".$attrName."\\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\5)(\\s+\\w+\\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\9))*\\s*&/i";
$arr=array();
$re=preg_match($pattern1,$str,$arr);
echo"&br/&\$arr[6]={$arr[6]}";
echo"&br/&没找到。";
$str1="&test attr='ddd'&";
getAttrValue($str1,"test","attr");
$str2="&test2 attr='ddd'attr2='ddd2't1=\"t1 value\"t2='t2 value'&";
getAttrValue($str2,"test2","t1");
这是把一个日期从MM/DD/YYYY的格式转为DD/MM/YYYY格式。输出26/08/2003
<h6 id="what-function-would-you-use-to-redirect-the-browser-to-a-new-pageyahoo" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.What function would you use to redirect the browser to a new page?(Yahoo)
A.redir()B.header()C.location()D.redirect()答案:Bredir()这不是一个PHP函数,会引致执行错误。header()这个是正确答案,header()函数发送头信息,可以用来使浏览器转向到另一个页面,例如:header("Location:")。location()这不是一个PHP函数,会引致执行错误。redirect()这不是一个PHP函数,会引致执行错误。
28.When turned on____________will_________your script with different variables fromHTML forms and cookies.(腾讯)A.show_errors,enableB.show_errors,showC.register_globals,enhanceD.register_globals,inject答案:C
29.一个函数的参数不能是对变量的引用,除非在php.ini中把____设为on。allow_call_time_pass_reference是否启用在函数调用时强制参数被按照引用传递
<h6 id="htmlmetametameta-http-equivcontent-typecontenttexthtmlcharsetgbkphphtmlmetacharsetbig5" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在HTML语言中,页面头部的meta标记可以用来输出文件的编码格式,以下是一个标准的meta语句&META http-equiv='Content-Type'content='text/charset=gbk'&,请使用PHP语言写一个函数,把一个标准HTML页面???的类似meta标记中的charset部分值改为big5。(新浪)
请注意:(1)需要处理完整的html页面,即不光此meta语句(2)忽略大小写(3)'和"在此处是可以互换的(4)'Content-Type'两侧的引号是可以忽略的,但'text/charset=gbk'两侧的不行(5)注意处理多余空格编写正则表达式如下:$reg1="/(&meta\\s*http-equiv\\s*=\\s*(['\"]?)Content-Type(\\2)\\s*content\\s*=\\s*(['\"])text\/charset=)(UTF-8)(\\4)(\\s*\/?&)/i";
<h6 id="php-1313135" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP中如何判断一个字符串是否是合法的日期模式: 13:13:13。要求代码不超过5行。(酷讯)
function checkDateTime($data){
if (date('Y-m-d H:i:s',strtotime($data)) == $data) {
return true;
return false;
$data = ' 13:35:42';
var_dump(checkDateTime($data));
$data = ' 13:35:42';
var_dump(checkDateTime($data));
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP中,如何获得一个数组的键值?(酷讯)
使用key()可以获得数组中当前元素的键名,使用current()则可以返回当前元素的值。使用array_keys()则可以得到数组中所有的键名。使用foreach结构foreach($arr as&key=&value)可以通过key和value分别获取键名和值。
<h6 id="smartysectiondata" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如果模板是用smarty模板。怎样用section语句来显示一个名为$data的组。比如:
$data=array(
0=&array('id'=&8,'name'=&'name1'),
1=&array('id'=&10,'name'=&'name2'),
2=&array('id'=&15,'name'=&'name3')
写出在模板页的代码?若用foreach语句又要怎样显示呢?
用section语句:
name=test loop=$data start=0 step=1}&
name:&/&/&
/section}&
用foreach语句:
from=$data item=test}&
name:&/&/&
/foreach}&
<h6 id=".xyzd-a.xyz" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.哪个选项会匹配下边的这个正则表达式?(/.*xyz\d/)A.*****xyz
B.*****xyz1C.******xyz2D.*xyz答案:C
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.以下哪个错误无法被标准的错误控制器获取?
A.E_WARNINGB.E_USER_ERRORC.E_PARSED.E_NOTICE答案:B
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.以下哪种错误类型无法被自定义的错误处理器捕捉到?(奇矩互动)
A.E_WARNINGB.E_USER_ERRORC.E_PARSED.E_NOTICE答案:C
<h6 id="ss__________" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.(^\s)|(\s$)这个正则表达式作用是:__________;
匹配以0个或多个空白符开头或者0个或多个空白符结尾的字符串
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.编写函数取得上一月的最后一天
date_default_timezone_set('PRC');
$date string 给定日期
string 上一月最后一天
function get_last_month_last_day($date = ''){
if ($date != '') {
$time = strtotime($date);
$time = time();
$day = date('j',$time);
return date('Y-m-d',strtotime("-{$day} days",$time));
echo get_last_month_last_day();
echo "&br /&";
echo get_last_month_last_day("");
<h6 id="apachetesthttpiptesttest" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在很多时候,我们可以通过apache的主配置文件来设置对test目录的访问权限控制,如http://IP/test请问如果需设置test下的一个子目录的访问控制权限,是否可以在主配置文件中修改,如果不可以应如何解决。
可以,还可以在需要控制的子目录下创建.htaccess文件,写入访问控制。
<h6 id="utf-8" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如果我的网站用的utf-8编码,为防止乱码出现,都需要注意哪些地方?
从以下几个方面考虑:
数据库中库和表都用utf8编码
php连接mysql,指定数据库编码为utf8&mysql_query(“set names utf8”);
php文件指定头部编码为utf-8header(“content-type:text/charset=utf-8”);
网站下所有文件的编码为utf8
html文件指定编码为utf-8&meta http-equiv="Content-Type"content="text/charset=utf-8"/&
<h6 id="urlget" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在url中用get传值的时候,若中文出现乱码,应该用哪个函数对中文进行编码?
urlencode()
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出两种对变量加密的函数?
md5(str);sha1(str);
<h6 id="-103025unix" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如何把 10:30:25变成unix时间戳?
date_default_timezone_set("PRC");
$unix_time = strtotime(" 10:30:45");
echo $unix_
echo "&br /&";
echo date("Y-m-d H:i:s",$unix_time);
<h6 id="gb2312utf-8" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如何把一个GB2312格式的字符串装换成UTF-8格式?
iconv('GB2312','UTF-8','悄悄是别离的笙箫');
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如果需要原样输出用户输入的内容,在数据入库前,要用哪个函数处理?
htmlspecialchars或者htmlentities
<h6 id="phpphp" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出五种以上你使用过的PHP的扩展的名称(提示:常用的PHP扩展)
mb_sring、iconv、curl、GD、XML、socket、、PDO等
<h6 id="mvcphpmvc" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.了解MVC模式吗?请写出三种以上目前PHP流行的MVC框架名称(不区分大小写)
FleaPHP、Zend Framework、CakePHP、Symfony、ThinkPHP、YII、CodeIgniter等
<h6 id="phpweb" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.php中WEB上传文件的原理是什么,如何限制上传文件的大小?
上传文件的表单使用post方式,并且要在form中添加enctype='multipart/form-data'。一般可以加上隐藏域:&input type=hidden name='MAX_FILE_SIZE' value=dddddd&,位置在file域前面。value的值是上传文件的客户端字节限制。可以避免用户在花时间等待上传大文件之后才发现文件过大上传失败的麻烦。使用file文件域来选择要上传的文件,当点击提交按钮之后,文件会被上传到服务器中的临时目录,在脚本运行结束时会被销毁,所以应该在脚本结束之前,将其移动到服务器上的某个目录下,可以通过函数move_uploaded_file()来移动临时文件,要获取临时文件的信息,使用$_FILES。
限制上传文件大小的因素有:
客户端的隐藏域MAX_FILE_SIZE的数值(可以被绕开)。
服务器端的upload_max_filesize,post_max_size和memory_limit。这几项不能够用脚本来设置。
自定义文件大小限制逻辑。即使服务器的限制是能自己决定,也会有需要个别考虑的情况。所以这个限制方式经常是必要的。
<h6 id="ubb-codeyg" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.简述UBB code的实现原理。(YG)
UBB代码是HTML的一个变种,通过程序自定义我们的标签,比如“[a]PHP中UBB的使用[/a]”这样的标签,其实质就是查找[a][/a]标签,将其替换成的标准html,说白了,就是将标准的html标记通过技术手段使其简化,其输出出来的结果还是标准的html。明白了ubb的原理,那么再制作一个简单的ubb编辑器就不难了,和fck之类的编辑器比较起来,ubb代码最大的优点就是代码简单,功能很少,简单的ubb只需要一个文件,而且ubb标签可以自己来定义,更改起来很方便,在php中就是利用替换函数就可以将html进行标签化,输出时进行标签的转化。
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.怎么把文件保存到指定目录?怎么避免上传文件重名问题?
可以自己设置上传文件的保存目录,与文件名拼凑形成一个文件路径,使用move_uploaded_file(),就可以完成将文件保存到指定目录。可以通过上传的文件名获取到文件后缀,然后使用时间戳+随机数+文件后缀的方式为文件重新命名,这样就避免了重名。
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #._____函数能返回脚本里的任意行中调用的函数的名称。该函数同时还经常被用在调试中,用来判断错误是如何发生的。(奇矩互动)
debug_print_backtrace()
<h6 id="smartyaarrayarrayid0arrayid1arrayid2id0-1html-ids" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板语法中怎么能遍历数组a=array(array(′id′=&0),array(′id′=&1),array(′id′=&2),……)id=&0-10000,怎么判断当id=&500,让输出的值在HTML里变为红色?(亿邮)设数组分配过来的数组名为ids
{section name=temp loop=$ids}
{if $ids[temp].id==500}
&span style=‘color:
{$ids[temp].id}
{/section}
<h6 id="smartyy-m-d-his" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板语法中如何获取当前时间,并且使用Y-m-d H:i:s的格式输出?(亿邮)
使用{$smarty.now}来获取当前时间,得到的是unix系统时间戳使用变量调节器进行格式化,如下:{$smarty.now|date_format:“%Y-%m-%d%H:%M:%S”}
<h6 id="smartyphp" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板语法中如何获取php的全局环境变量(亿邮)
$smarty.get.变量 #显示通过get方式传过来的指定变量的值$smarty.post.变量 #显示通过post方式传过来的指定变量的值$smarty.cookies.变量 #显示通过cookie中指定变量的值$smarty.server.SERVER_NAME #显示server变量值,$_SERVER系列变量$smarty.env.PATH #显示系统环境变量值,$_ENV系列变量$smarty.session.变量 #显示session中指定变量的值$smarty.request.变量 #显示通过post、get、cookie中指定变量的值
<h6 id="smarty" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板中如何用自定义函数(亿邮)
使用模板分隔符包含,传递参数则使用HTML属性的方式,例如:{html_image file="pumpkin.jpg"}
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.列举出你所知道的php系统函数库例如,数学函数库(亿邮)
mysql,gd,pdo,XML,zip,filesystem,mail等
<h6 id="utf-8gb2312" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.假如让你来写一个函数实现Utf-8转gb2312,那么函数的名称应该怎么命名?(亿邮)
utf8_to_gb2312或者utf8togb2312
<h6 id="url" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请描述如下URL重写规则的用意。(卓望)
&IfModulemod_rewrite.c&
RewriteEngineon
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteBase/
RewriteRule./index.php[L]
&/IfModule&
如果REQUEST_FILENAME文件存在,就直接访问文件,不进行下面的rewrite规则,如果REQUEST_FILENAME目录存在,就直接访问目录,不进行下面的rewrite规则,RewriteRule./index.php[L]的意思是把所有的请求都给index.php处理。
一般是在header、set_cookie以及session_start函数前面有输出(包括空格)的情况下,会报该警告信息r、set_cookie以及session_start函数前面有输出(包括空格)的情况下,会报该警告信息
一、PHP核心技术
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出一个能创建多级目录的PHP函数(新浪网技术部)
$path string 要创建的目录
$mode int 创建目录的模式,在windows下可忽略
function create_dir($path,$mode = 0777)
if (is_dir($path)) {
echo "该目录已经存在";
if (mkdir($path,$mode,true)) {
echo "创建目录成功";
echo "创建目录失败";
<h6 id="smarty" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出smarty模板的特点(新浪网技术部)
速度快,编译型,缓存技术,插件机制,强大的表现逻辑
<h6 id="php.inisafe_mode6" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.打开php.ini中的safe_mode,会影响哪些函数?至少说出6个。(新浪)
safe_mode,安全模式,它提供一个基本安全的共享环境,在一个有多个用户账户存在的php开发的web服务器上。当安全模式打开的时候,一些函数将被完全的禁止,而另一些函数的功能将会受到限制,如:chdir,move_uploaded_file,chgrp,parse_ini_file,chown,rmdir,copy,rename,fopen,require,mkdir,unlink等。注意,在php5.3以上版本,safe_mode被弃用,在php5.4以上版本,则将此特性完全去除了。
<h6 id="51.com" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.抓取远程图片到本地,你会用什么函数?(51.com笔试题)
file_get_contents或者curl
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP的垃圾收集机制是怎样的(腾讯)
PHP可以自动进行内存管理,清除不再需要的对象。PHP使用了引用计数(reference counting)这种单纯的垃圾回收(garbage collection)机制。每个对象都内含一个引用计数器,每个reference连接到对象,计数器加1。当reference离开生存空间或被设为NULL,计数器减1。当某个对象的引用计数器为零时,PHP知道你将不再需要使用这个对象,释放其所占的内存空间。
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请写一段PHP代码,确保多个进程同时写入同一个文件成功(腾讯)
核心思路:加锁
$fp = fopen("lock.txt","w+");
if (flock($fp,LOCK_EX)) {
fwrite($fp, "write something");
flock($fp, LOCK_UN);
echo "file is locking...";
fclose($fp);
<h6 id="urlhttpwww.sina.com.cnabcdefg.phpid1php.php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写一个函数,尽可能高效的,从一个标准url里取出文件的扩展名,例如:)
function getExt1($url){
$arr = parse_url($url);
$file = basename($arr['path']);
$ext = explode('.', $file);
return $ext[count($ext)-1];
function getExt2($url){
$url = basename($url);
$pos1 = strpos($url,'.');
$pos2 = strpos($url,'?');
if (strstr($url,'?')) {
return substr($url,$pos1+1,$pos2-$pos1-1);
return substr($url,$pos1);
$path = "http://www.sina.com.cn/abc/de/fg.php?id=1";
echo getExt1($path);
echo "&br /&";
echo getExt2($path);
相关题目:使用五种以上方式获取一个文件的扩展名,要求:dir/upload.image.jpg,找出.jpg或者jpg,必须使用PHP自带的处理函数进行处理,方法不能明显重复,可以封装成函数,比如get_ext1(filename),getext2(file_name)
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写一个函数,能够遍历一个文件夹下的所有文件和子文件夹。(新浪)
function my_scandir($dir){
$files = array();
if(is_dir($dir)){
if ($handle = opendir($dir)) {
while (($flie = readdir($handle))!== false) {
if ($flie!="." && $file!="..") {
if (is_dir($dir."/".$file)) {
$files[$file] = my_scandir($dir."/".$file);
$files[] = $dir."/".$
closedir($handle);
[!!!]9.简述论坛中无限分类的实现原理。(新浪)
创建类别表如下:
CREATE TABLE category(
cat_id smallint unsigned not null auto_increment primary key comment'类别ID',
cat_name VARCHAR(30)NOT NULL DEFAULT''COMMENT'类别名称',
parent_id SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT'类别父ID'
)engine=MyISAM charset=utf8;
编写一个函数,递归遍历,实现无限分类
function tree($arr,$pid=0,$level=0){
static $list = array();
foreach ($arr as $v) {
if ($v['parent_id'] == $pid) {
$v['level'] = $
$list[] = $v;
tree($arr,$v['cat_id'],$level+1);
<h6 id="aabcde.phpbab1234c.phpba....cd" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写一个函数,算出两个文件的相对路径,如a=′/a/b/c/d/e.php′;b='/a/b/12/34/c.php';计算出b相对于a的相对路径应该是../../c/d(新浪)
function releative_path($path1,$path2){
$arr1 = explode("/",dirname($path1));
$arr2 = explode("/",dirname($path2));
for ($i=0,$len = count($arr2); $i & $ $i++) {
if ($arr1[$i]!=$arr2[$i]) {
if ($i==1) {
$return_path = array();
if ($i != 1 && $i & $len) {
$return_path = array_fill(0, $len - $i,"..");
if ($i == $len) {
$return_path = array('./');
$return_path = array_merge($return_path,array_slice($arr1,$i));
return implode('/',$return_path);
$a = '/a/b/c/d/e.php';
$b = '/a/b/12/34/c.php';
$c = '/e/b/c/d/f.php';
$d = '/a/b/c/d/g.php';
echo releative_path($a,$b);
echo "&br /&";
echo releative_path($a,$c);
echo "&br /&";
echo releative_path($a,$d);
echo "&br /&";
<h6 id="mysql_fetch_rowmysql_fetch_array" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.mysql_fetch_row()和mysql_fetch_array()有什么分别?
mysql_fetch_row()把的一列储存在一个以零为基数的数组中,第一栏在数组的索引0,第二栏在索引1,依此类推。mysql_fetch_assoc()把数据库的一列储存在一个关联数组中,数组的索引就是字段名称,例如我的数据库查询送回“first_name”、“last_name”、“email”三个字段,数组的索引便是“first_name”、“last_name”和“email”。mysql_fetch_array()可以同时送回mysql_fetch_row()和mysql_fetch_assoc()的值。
<h6 id="phphttpwww.phpres.comindex.html" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.有一个网页地址,比如PHP开发资源网主页:?
方法1(对于PHP5及更高版本):
$readcontents=fopen("http://www.phpres.com/index.html","rb");
$contents=stream_get_contents($readcontents);
fclose($readcontents);
echo $contents;
echo file_get_contents("http://www.phpres.com/index.html");
<h6 id="mvc" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.谈谈对mvc的认识
由模型(model),视图(view),控制器(controller)完成的应用程序。model层负责提供数据,和数据库有关的操作都交给模型层来处理,view层则提供交互的界面,并输出数据,而controller层则负责接收请求,并分发给相应的model来处理,然后调用view层来显示。
[!]14.What does the GD library do?(Yahoo)
GD库提供了一系列用来处理图片的API,使用GD库可以处理图片,或者生成图片。在网站上GD库通常用来生成缩略图或者用来对图片加水印或者对网站数据生成报表。自从PHP 4.3.0版本后GD便内建在PHP系统中。
<h6 id="what-function-can-you-use-to-open-a-file-for-reading-and-writingyahoo" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.What function can you use to open a file for reading and writing?(Yahoo)
A.fget();B.file_open();C.fopen();D.open_file();答案:Cfget()这不是一个PHP函数,会引致执行错误。file_open()这不是一个PHP函数,会引致执行错误。fopen()这是正确答案,fopen()可以用来开启档案以便读写。open_file()这不是一个PHP函数,会引致执行错误。
[!!]16.Smarty的原理
smarty是一个模板引擎,使用smarty主要是为了实现逻辑和外在内容的分离,如果不使用模板的话,通常的做法就是php代码和html代码混编。使用了模板之后,则可以将业务逻辑都放到php文件中,而负责显示内容的模板则放到html文件中。Smarty在执行display方法的时候,读取模板文件,并进行数据替换,生成编译文件,之后每次访问都会直接访问编译文件,读取编译文件省去了读取模板文件,和字符串替换的时间,所以可以更快,编译文件里时间戳记录模板文件修改时间,如果模板被修改过就可以检测到,然后重新编译(编译是把静态内容保存起来,动态内容根据传入的参数不同而不同)。如果启用了缓存,则会根据编译文件生成缓存文件,在访问的时候如果有缓存文件并且缓存文件没有过期,则直接访问缓存文件。
相关题目1:能够使HTML和PHP分离开使用的模板
smarty,phplib等
相关题目2:您是否用过模板引擎?如果有您用的模板引擎的名字是?
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP如何实现页面跳转
方法一:php函数跳转,缺点,header头之前不能有输出,跳转后的程序继续执行,可用exit中断执行后面的程序。header("Location:网址");//直接跳转header("refresh:3;url=http://axgle.za");//三秒后跳转
方法二:利用metaecho"&meta http-equiv=refresh content='0;url=网址'&";
<h6 id="phpsql-serveroracle" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP可以和sql server/oracle等数据库连接吗?
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.使用哪些工具进行版本控制?
SVN或者CVS
相关题目:您是否用过版本控制软件?如果有您用的版本控制软件的名字是?
TortoiseSVN-1.2.6
<h6 id="jsvbsscript" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出一个正则表达式,过虑网页上的所有JS/VBS脚本(即把script标记及其内容都去掉):
过滤脚本参考:
header("content-type:text/charset=utf-8");
$script = "以下内容不显示:&script type='text/javascript'&alert('cc');&/script&";
$pattern = '/&script[^&]*?&.*?&/script&/si';
echo preg_replace($pattern, "脚本内容", $script);
方案一,使用PHP内建函数strip_tags()除去HTML标签方案二,自定义函数,如下:
header("content-type:text/charset=utf-8");
function strip_html_tags($str){
$pattern = '/&("[^"]*"|\'[^\']\*\'|[^&"\'])*&/';
return preg_replace($pattern,'',$str);
$html = '&p id=""&ddddd&br /&&/p&';
echo strip_html_tags($html);
echo "&br /&";
$html = '&p id="&"&bb&br /&aaa&br /&&/p&';
echo strip_html_tags($html);
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请写一个函数验证电子邮件的格式是否正确(要求使用正则)(新浪)
preg_match('/^[\w\-\.]+@[\w\-]+(\.\w+)+$/',$email);
相关题目:请用正则表达式写一个函数,验证电子邮件的格式是否正确。(鑫众人云)
<h6 id="posixperl" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请对POSIX风格和兼容Perl风格两种正则表达式的主要函数进行类比说明(腾讯)
主要区别有以下三种:
preg_replace()里面的正则可以写成型如:"/.xxx/"而ereg_replace()里面的正则需写成型如 "xxx"
preg_replace()能操作数组,而ereg_replace()不可以
在逆向引用用preg_replace()可使用0-99个,而ereg_replace()最多为9个
使用Perl兼容正则表达式语法的preg_match()函数通常是比ereg()更快的替代方案。
<h6 id="phpphp" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请写出并说明如何在命令行下运行PHP脚本(写出两种方式)同时向PHP脚本传递参数?(腾讯)
首先进入php安装目录php -f d:/wamp/www/1.php 其中-f参数指定要执行的php文件php -r phpinfo(); 其中-r表示直接执行php代码,无需写开始结束标记
<h6 id="htmlxmltestattr" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.使用正则表达式提取一段标识语言(html或xml)代码段中指定标签的指定属性值(需考虑属性值对不规则的情况,如大小写不敏感,属性名值与等号间有空格等)。此处假设需提取test标签的attr属性值,请自行构建包含该标签的串(腾讯)
编写如下函数:
header("content-type:text/charset=utf-8");
function getAttrValue($str,$tagName,$attrName){
$pattern1="/&".$tagName."(\\s+\\w+\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\2))*\\s+".$attrName."\\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\5)(\\s+\\w+\\s*=\\s*([\\'\\\"]?)([^\\'\\\"]*)(\\9))*\\s*&/i";
$arr=array();
$re=preg_match($pattern1,$str,$arr);
echo"&br/&\$arr[6]={$arr[6]}";
echo"&br/&没找到。";
$str1="&test attr='ddd'&";
getAttrValue($str1,"test","attr");
$str2="&test2 attr='ddd'attr2='ddd2't1=\"t1 value\"t2='t2 value'&";
getAttrValue($str2,"test2","t1");
这是把一个日期从MM/DD/YYYY的格式转为DD/MM/YYYY格式。输出26/08/2003
<h6 id="what-function-would-you-use-to-redirect-the-browser-to-a-new-pageyahoo" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.What function would you use to redirect the browser to a new page?(Yahoo)
A.redir()B.header()C.location()D.redirect()答案:Bredir()这不是一个PHP函数,会引致执行错误。header()这个是正确答案,header()函数发送头信息,可以用来使浏览器转向到另一个页面,例如:header("Location:")。location()这不是一个PHP函数,会引致执行错误。redirect()这不是一个PHP函数,会引致执行错误。
28.When turned on____________will_________your script with different variables fromHTML forms and cookies.(腾讯)A.show_errors,enableB.show_errors,showC.register_globals,enhanceD.register_globals,inject答案:C
29.一个函数的参数不能是对变量的引用,除非在php.ini中把____设为on。allow_call_time_pass_reference是否启用在函数调用时强制参数被按照引用传递
<h6 id="htmlmetametameta-http-equivcontent-typecontenttexthtmlcharsetgbkphphtmlmetacharsetbig5" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在HTML语言中,页面头部的meta标记可以用来输出文件的编码格式,以下是一个标准的meta语句&META http-equiv='Content-Type'content='text/charset=gbk'&,请使用PHP语言写一个函数,把一个标准HTML页面???的类似meta标记中的charset部分值改为big5。(新浪)
请注意:(1)需要处理完整的html页面,即不光此meta语句(2)忽略大小写(3)'和"在此处是可以互换的(4)'Content-Type'两侧的引号是可以忽略的,但'text/charset=gbk'两侧的不行(5)注意处理多余空格编写正则表达式如下:$reg1="/(&meta\\s*http-equiv\\s*=\\s*(['\"]?)Content-Type(\\2)\\s*content\\s*=\\s*(['\"])text\/charset=)(UTF-8)(\\4)(\\s*\/?&)/i";
<h6 id="php-1313135" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP中如何判断一个字符串是否是合法的日期模式: 13:13:13。要求代码不超过5行。(酷讯)
function checkDateTime($data){
if (date('Y-m-d H:i:s',strtotime($data)) == $data) {
return true;
return false;
$data = ' 13:35:42';
var_dump(checkDateTime($data));
$data = ' 13:35:42';
var_dump(checkDateTime($data));
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.PHP中,如何获得一个数组的键值?(酷讯)
使用key()可以获得数组中当前元素的键名,使用current()则可以返回当前元素的值。使用array_keys()则可以得到数组中所有的键名。使用foreach结构foreach($arr as&key=&value)可以通过key和value分别获取键名和值。
<h6 id="smartysectiondata" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如果模板是用smarty模板。怎样用section语句来显示一个名为$data的组。比如:
$data=array(
0=&array('id'=&8,'name'=&'name1'),
1=&array('id'=&10,'name'=&'name2'),
2=&array('id'=&15,'name'=&'name3')
写出在模板页的代码?若用foreach语句又要怎样显示呢?
用section语句:
name=test loop=$data start=0 step=1}&
name:&/&/&
/section}&
用foreach语句:
from=$data item=test}&
name:&/&/&
/foreach}&
<h6 id=".xyzd-a.xyz" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.哪个选项会匹配下边的这个正则表达式?(/.*xyz\d/)A.*****xyz
B.*****xyz1C.******xyz2D.*xyz答案:C
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.以下哪个错误无法被标准的错误控制器获取?
A.E_WARNINGB.E_USER_ERRORC.E_PARSED.E_NOTICE答案:B
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.以下哪种错误类型无法被自定义的错误处理器捕捉到?(奇矩互动)
A.E_WARNINGB.E_USER_ERRORC.E_PARSED.E_NOTICE答案:C
<h6 id="ss__________" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.(^\s)|(\s$)这个正则表达式作用是:__________;
匹配以0个或多个空白符开头或者0个或多个空白符结尾的字符串
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.编写函数取得上一月的最后一天
date_default_timezone_set('PRC');
$date string 给定日期
string 上一月最后一天
function get_last_month_last_day($date = ''){
if ($date != '') {
$time = strtotime($date);
$time = time();
$day = date('j',$time);
return date('Y-m-d',strtotime("-{$day} days",$time));
echo get_last_month_last_day();
echo "&br /&";
echo get_last_month_last_day("");
<h6 id="apachetesthttpiptesttest" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在很多时候,我们可以通过apache的主配置文件来设置对test目录的访问权限控制,如http://IP/test请问如果需设置test下的一个子目录的访问控制权限,是否可以在主配置文件中修改,如果不可以应如何解决。
可以,还可以在需要控制的子目录下创建.htaccess文件,写入访问控制。
<h6 id="utf-8" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如果我的网站用的utf-8编码,为防止乱码出现,都需要注意哪些地方?
从以下几个方面考虑:
数据库中库和表都用utf8编码
php连接mysql,指定数据库编码为utf8&mysql_query(“set names utf8”);
php文件指定头部编码为utf-8header(“content-type:text/charset=utf-8”);
网站下所有文件的编码为utf8
html文件指定编码为utf-8&meta http-equiv="Content-Type"content="text/charset=utf-8"/&
<h6 id="urlget" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在url中用get传值的时候,若中文出现乱码,应该用哪个函数对中文进行编码?
urlencode()
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出两种对变量加密的函数?
md5(str);sha1(str);
<h6 id="-103025unix" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如何把 10:30:25变成unix时间戳?
date_default_timezone_set("PRC");
$unix_time = strtotime(" 10:30:45");
echo $unix_
echo "&br /&";
echo date("Y-m-d H:i:s",$unix_time);
<h6 id="gb2312utf-8" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如何把一个GB2312格式的字符串装换成UTF-8格式?
iconv('GB2312','UTF-8','悄悄是别离的笙箫');
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.如果需要原样输出用户输入的内容,在数据入库前,要用哪个函数处理?
htmlspecialchars或者htmlentities
<h6 id="phpphp" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.写出五种以上你使用过的PHP的扩展的名称(提示:常用的PHP扩展)
mb_sring、iconv、curl、GD、XML、socket、、PDO等
<h6 id="mvcphpmvc" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.了解MVC模式吗?请写出三种以上目前PHP流行的MVC框架名称(不区分大小写)
FleaPHP、Zend Framework、CakePHP、Symfony、ThinkPHP、YII、CodeIgniter等
<h6 id="phpweb" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.php中WEB上传文件的原理是什么,如何限制上传文件的大小?
上传文件的表单使用post方式,并且要在form中添加enctype='multipart/form-data'。一般可以加上隐藏域:&input type=hidden name='MAX_FILE_SIZE' value=dddddd&,位置在file域前面。value的值是上传文件的客户端字节限制。可以避免用户在花时间等待上传大文件之后才发现文件过大上传失败的麻烦。使用file文件域来选择要上传的文件,当点击提交按钮之后,文件会被上传到服务器中的临时目录,在脚本运行结束时会被销毁,所以应该在脚本结束之前,将其移动到服务器上的某个目录下,可以通过函数move_uploaded_file()来移动临时文件,要获取临时文件的信息,使用$_FILES。
限制上传文件大小的因素有:
客户端的隐藏域MAX_FILE_SIZE的数值(可以被绕开)。
服务器端的upload_max_filesize,post_max_size和memory_limit。这几项不能够用脚本来设置。
自定义文件大小限制逻辑。即使服务器的限制是能自己决定,也会有需要个别考虑的情况。所以这个限制方式经常是必要的。
<h6 id="ubb-codeyg" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.简述UBB code的实现原理。(YG)
UBB代码是HTML的一个变种,通过程序自定义我们的标签,比如“[a]PHP中UBB的使用[/a]”这样的标签,其实质就是查找[a][/a]标签,将其替换成的标准html,说白了,就是将标准的html标记通过技术手段使其简化,其输出出来的结果还是标准的html。明白了ubb的原理,那么再制作一个简单的ubb编辑器就不难了,和fck之类的编辑器比较起来,ubb代码最大的优点就是代码简单,功能很少,简单的ubb只需要一个文件,而且ubb标签可以自己来定义,更改起来很方便,在php中就是利用替换函数就可以将html进行标签化,输出时进行标签的转化。
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.怎么把文件保存到指定目录?怎么避免上传文件重名问题?
可以自己设置上传文件的保存目录,与文件名拼凑形成一个文件路径,使用move_uploaded_file(),就可以完成将文件保存到指定目录。可以通过上传的文件名获取到文件后缀,然后使用时间戳+随机数+文件后缀的方式为文件重新命名,这样就避免了重名。
<h6 style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #._____函数能返回脚本里的任意行中调用的函数的名称。该函数同时还经常被用在调试中,用来判断错误是如何发生的。(奇矩互动)
debug_print_backtrace()
<h6 id="smartyaarrayarrayid0arrayid1arrayid2id0-1html-ids" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板语法中怎么能遍历数组a=array(array(′id′=&0),array(′id′=&1),array(′id′=&2),……)id=&0-10000,怎么判断当id=&500,让输出的值在HTML里变为红色?(亿邮)设数组分配过来的数组名为ids
{section name=temp loop=$ids}
{if $ids[temp].id==500}
&span style=‘color:
{$ids[temp].id}
{/section}
<h6 id="smartyy-m-d-his" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板语法中如何获取当前时间,并且使用Y-m-d H:i:s的格式输出?(亿邮)
使用{$smarty.now}来获取当前时间,得到的是unix系统时间戳使用变量调节器进行格式化,如下:{$smarty.now|date_format:“%Y-%m-%d%H:%M:%S”}
<h6 id="smartyphp" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板语法中如何获取php的全局环境变量(亿邮)
$smarty.get.变量 #显示通过get方式传过来的指定变量的值$smarty.post.变量 #显示通过post方式传过来的指定变量的值$smarty.cookies.变量 #显示通过cookie中指定变量的值$smarty.server.SERVER_NAME #显示server变量值,$_SERVER系列变量$smarty.env.PATH #显示系统环境变量值,$_ENV系列变量$smarty.session.变量 #显示session中指定变量的值$smarty.request.变量 #显示通过post、get、cookie中指定变量的值
<h6 id="smarty" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.在Smarty模板中如何用自定义函数(亿邮)
使用模板分隔符包含,传递参数则使用HTML属性的方式,例如:{html_image file="pumpkin.jpg"}
<h6 id="php" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.列举出你所知道的php系统函数库例如,数学函数库(亿邮)
mysql,gd,pdo,XML,zip,filesystem,mail等
<h6 id="utf-8gb2312" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.假如让你来写一个函数实现Utf-8转gb2312,那么函数的名称应该怎么命名?(亿邮)
utf8_to_gb2312或者utf8togb2312
<h6 id="url" style="margin: 0 padding: 0 font-family: &microsoft yahei&; font-size: 11 color: #.请描述如下URL重写规则的用意。(卓望)
&IfModulemod_rewrite.c&
RewriteEngineon
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteBase/
RewriteRule./index.php[L]
&/IfModule&
如果REQUEST_FILENAME文件存在,就直接访问文件,不进行下面的rewrite规则,如果REQUEST_FILENAME目录存在,就直接访问目录,不进行下面的rewrite规则,RewriteRule./index.php[L]的意思是把所有的请求都给index.php处理。
一般是在header、set_cookie以及session_start函数前面有输出(包括空格)的情况下,会报该警告信息
阅读(...) 评论()

我要回帖

更多关于 tplink wifi 乱码 的文章

 

随机推荐