解决方案 »
- [正则表达式]请教如何"匹配以某字符串结尾或者结束".例如MV&id=17328895840&scm=102和MV&id=17328895840都可以匹配
- i++的问题
- 判断php页面离开或跳转,并销毁 session
- 关开 session 问题,根本没到我设的超出时间,就失效了、自定义的 session_set_save_handler
- java script变量赋值给php变量,
- 本人刚入门,请教一个低级问题,请大家指点
- 高分寻求一解决方案 ! 两台主机之间的有条件限制的安全数据传输 ! 关注有分!
- 关于,弹出新窗口的问题?
- session控制身份验证问题
- 关于苹果机访问apache服务器的问题!
- 为什么我PHP函数执行问没有释放内存
- 听人说过数据分表,请问具体怎么做到
echo $result;最好是
echo base64_encode($result);的结果
使用 base64_encode($result); 为 77u/MQ==我现在换了一个方法就是不判断他的值 而是判断他返回值的长度
$result; 为1 长度为4 为11 长度为5 为111 长度为6
header("Content-Type: text/html; charset=utf-8");
require_once(dirname(__FILE__)."/include/config_base.php");
$upid=$_POST['upid'];
$uppas=$_POST['uppas'];
$dsql=New dedesql(false); $sql="select * from #@__uu where upid='$upid' and uppas='".md5($uppas)."'";
$dsql->SetQuery($sql);
$dsql->Execute();
$rowcount=$dsql->GetTotalRow();
$row=$dsql->getone();
if ($rowcount==0){
echo '111';
}else
{
$uploaddir = dirname(__FILE__)."\\upimg\\";
$uploadfile = $uploaddir . basename($_FILES['upimg']['name']);
if (move_uploaded_file($_FILES['upimg']['tmp_name'], $uploadfile)) {
echo "1";
} else {
echo "11";
}
}
header("Content-Type: text/html; charset=utf-8");
好像也无效
$s = base64_decode($s);print_r(unpack('H*', $s));Array
(
[1] => efbbbf31
)显然你的目标程序是带有 BOM 头的
网上找了段取出BOM的程序 供大家使用下<?php
//remove the utf-8 boms
//by magicbug at gmail dot comif (isset($_GET['dir'])){ //config the basedir
$basedir=$_GET['dir'];
}else{
$basedir = '.';
} $auto = 1; checkdir($basedir);function checkdir($basedir){
if ($dh = opendir($basedir)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..'){
if (!is_dir($basedir."/".$file)) {
echo "filename: $basedir/$file ";
echo checkBOM("$basedir/$file")." <br>";
}else{
$dirname = $basedir."/".$file;
checkdir($dirname);
}
}
}
closedir($dh);
}
}function checkBOM ($filename) {
global $auto;
$contents = file_get_contents($filename);
$charset[1] = substr($contents, 0, 1);
$charset[2] = substr($contents, 1, 1);
$charset[3] = substr($contents, 2, 1);
if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {
if ($auto == 1) {
$rest = substr($contents, 3);
rewrite ($filename, $rest);
return ("<font color=red>BOM found, automatically removed.</font>");
} else {
return ("<font color=red>BOM found.</font>");
}
}
else return ("BOM Not Found.");
}function rewrite ($filename, $data) {
$filenum = fopen($filename, "w");
flock($filenum, LOCK_EX);
fwrite($filenum, $data);
fclose($filenum);
}
?>