php总结 --- 22. 面试题002
1. 介绍一下常见的SSO(单点登陆)方案(比如dedecms整合discuz的passport)的原理
1. http://blog.chedushi.com/archives/10620
2. http://www.imooc.com/learn/633
3. http://www.onmpw.com/tm/xwzj/network_145.html
2. 测试php性能和mysql数据库性能的工具,和找出瓶颈的方法
3. session跨域共享
1. http://www.cnblogs.com/wangtao_20/archive/2011/02/16/1955659.html
2. http://www.cnblogs.com/acpp/archive/2011/06/10/2077592.html
3. http://www.liaoxiansheng.cn/?p=121
4. http://www.onmpw.com/tm/xwzj/network_144.html
4. socket的使用
5. 常用正则匹配
1. 邮箱:
2. HTML:
3. JS:
4.
6. php获取函数参数的3种方式
1. $argc $argv
2. getopt()
3. 用户传进来的实际参数
7. error_reporting
8. 上传文件是的错误列表
9. 写代码来解决多进程/线程同时读写一个文件的问题
PHP是不支持多线程的,可以使用php的flock加锁函数实现。
$fp = fopen("/tmp/lock.txt", "w+");
if (flock($fp, LOCK_EX)) { // 进行排它型锁定
fwrite($fp, "Write something here\n");
flock($fp, LOCK_UN); // 释放锁定
} else {
echo "Couldn't lock the file !";
}
fclose($fp);
10. 写一段上传文件的代码
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 upload.html 2 <form enctype="multipart/form-data" method="POST" action="upload.php"> 3 Send this file: <input name="name" type="file" /> 4 <input type="submit" value="Send File" /> 5 </form> 6 7 upload.php 8 $uploads_dir = '/uploads'; 9 foreach ($_FILES["error"] as $key => $error) { 10 if ($error == UPLOAD_ERR_OK) { 11 $tmp_name = $_FILES["tmp_name"][$key]; 12 $name = $_FILES["name"][$key]; 13 move_uploaded_file($tmp_name, "$uploads_dir/$name"); 14 } 15 }
11. 链接
1. http://blog.csdn.net/s1070/article/list/2
2. https://my.oschina.net/banbo/blog/303308
3. http://www.liaoxiansheng.cn/?p=324
4. http://www.cnblogs.com/hellohell/p/6207831.html(nginx)
5. http://www.cnblogs.com/hellohell/p/5718319.html(正则)
6. http://blog.csdn.net/s1070/article/list/2