求助 curl_exec 返回值判断问题 本帖最后由 q9972 于 2011-11-15 21:02:18 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 贴出你未经处理的 $result 的值echo $result;最好是 echo base64_encode($result);的结果 直接 echo $result; 为1 使用 strlen($result) 长度为4 可能是编码问题使用 base64_encode($result); 为 77u/MQ==我现在换了一个方法就是不判断他的值 而是判断他返回值的长度$result; 为1 长度为4 为11 长度为5 为111 长度为6header("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 = '77u/MQ==';$s = base64_decode($s);print_r(unpack('H*', $s));Array( [1] => efbbbf31)显然你的目标程序是带有 BOM 头的 问题已解决 我也不知道BOM是什么东西 刚上手php 网上找了段取出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);}?> 有关404的一道难题[实战] 这些网站是怎么知道我在GOOGLE上搜索的内容的????? 如何使用section php上传问题? php需要如何配制啊? 谁用过PHP在命令行调用,怎么传递参数,有没有例程,我写的都接收不到参数????? 怎么自动跳转到前一页和关闭窗口及自动关闭? php对文件管理,那里有较好的脚本! 初学PHP和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);
}
?>