1、用PHP打印出前一天的时间式是2013-04-2222:21:21 echo date('Y-m-d H:i:s', strtotime('-1 day')); 2、echo(),print(),print_r()的区别 echo和print都能输出字符串,但没有返回,print能够输出式化的字符串而print_r通常用于打印变量的相关信息,如数组
1、用PHP打印出前一天的时间格式是2013-04-2222:21:21
echo date('Y-m-d H:i:s', strtotime('-1 day'));
2、echo(),print(),print_r()的区别
echo和print都能输出字符串,但没有返回值,print能够输出格式化的字符串而print_r通常用于打印变量的相关信息,如数组
3、实现字符串的反转
strrev()
4、优化MYSQL数据库的方法
1)对索引进行优化
2)通过慢查询日志
3)定位SQL查询
5、用PHP写出显示客户端IP与服务器IP的代码
echo $_SERVER['REMOTE_ADDR'];
echo $_SERVER['SERVER_ADDR'];
6、语句include和require的区别是射门?为避免多次包含同一文件,可以使用什么代替?
include和require都是只包含文档,但require会产生致命错误而include只产生警告,可以使用require_once和include_once来代替
7、如何修改SESSION的生存时间
通过session_set_cookie_params('3600');
8、有一个网页地址,比如百度:http://www.baidu.com如何得到它的内容
$context = stream_context_create(array(
'http' => array(
'timeout' => 1 // 设置一个超时时间,单位为秒
)
));
file_get_content('http://www.baidu.com');
9、在HTTP1.0中,状态码401的含义是未收授权,如果返回“找不到文件”的提示,则可用header函数,其语句header('HTTP1.0 404 Not Found')
10、在PHP中,heredoc是一种特殊的字符串,它的结束标志必须?
结束标志不能包含其他任何字符除了';'
11、说明PHP中传值和传引用的区别,什么时候传值什么时候传引用?
函数内对传送变量修改不影响被传变量的值(用传值对函数内的变量重新赋值);
传送变量的引用,函数内的任何操作等同于对传送变量的操作,传送大型变量时效率高
12、在PHP中error_reporting函数的作用是什么?
设置报错级别
error_reporting(0); // 禁用错误报告
error_reporting(E_ERROR|E_WARNING|E_PARSE); // 报告运行时错误
error_reporting(E_ALL); // 报告所有错误
13、JS的转向函数是?怎么引入一个外部JS文件?
location.href
14、foo()和@foo()之间有什么区别?
@foo()控制错误输出
15、mysql_fetch_row()和mysql_fetch_array()之间有什么区别?
两个函数都返回一个数组,不同点在于前者返回只包含值,后者返回包含键值对
16、检测一个变量是否有设置的函数是?是否为空的函数是?
isset() empty()
17、写一个函数,能够遍历一个文件夹下的所有文件盒子文件夹。
function scan_directory($dir) {
$result = array();
$cdir = scandir($dir);
foreach ($cdir as $key =>$value) {
if(!in_array($value, array('.', '..'))) {
if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
$result[$value] = scan_directory($dir . DIRECTORY_SEPARATOR .$value);
}else {
$result[] = $value;
}
}
}
return $result;
}
print_r(scan_directory(dirname(__FILE__)));
18、utf-8和gbk区别
utf-8是国际编码,通用性较强,英文采用单字节编码中文采用三字节编码。而gbk是国家标准编码,采用双字节编码
19、MySQL的存储引擎MyISAM与InnoDB有什么区别
1)、两者在文件构成上有区别;
2)、InnoDB支持事务处理,MyISAM不支持;
3)、锁的区别:InnoDB支持表级锁和行级锁,MyISAM只支持表级锁。
二 PHP试题(2)
1、随便说出3个php处理数组的内置函数,如果说不出可以说说思路
例如:array_merge array_keysarray_diff array_values
2、怎么判断两个数组相等
我的理解应该是键值都相等
3、你熟悉的PHP框架有哪些?
4、get_magic_quotes_gpc()的作用是什么(新浪试题)
5、其中有问到对MongoDB的底层有过了解没?说说你对Redis的理解?以及Redis有哪些场景应用,并分别就一两种场景说说使用到哪些redis的相关知识?
三NodeJS试题
1、 '1' + 2 + 3
1 + 2 + '3'
上面的返回值是多少?
2、下面的返回值又是多少?
'hello world'.indexOf('hello');
['hello', 'world'].indexOf('hello');
{'hello': 'world'}.indexOf('hello');
3、以下自己平时印象比较深刻的整理的
以下返回
var str = 'xcsasds';
alert(str.slice(0, -3));
alert(str.substring(1, -3));
4、function add(x, y) {
return x + y;
}
var add;
// var add = 3; // 换成赋值的返回又是啥
alert(typeof add);
5、var test;
var str1 = new String(test);
var str2 = test.toString();
alert(str1);
alert(str2);
输出结果是什么?
6、以下输出结果?
var str = '25';
console.log(typeof str);
var str2 = +str;
console.log(typeof str2);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
