关于array_diff函数的问题 把兩個txt轉為base64,再看看是否相同。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private function CheckFileType($array){ $type=""; foreach($this->filetypearray as $name=>$value){ $ar=array_diff($array,$value); if(empty($ar)){ $type=$name; } } return $type; }private $filetypearray=array( 'downloadfile'=>array('order-id','order-item-id','purchase-date','payments-date','buyer-email', 'buyer-name','buyer-phone-number','sku','product-name','quantity-purchased','currency','item-price', 'item-tax','shipping-price','shipping-tax','ship-service-level','recipient-name','ship-address-1', 'ship-address-2','ship-address-3','ship-city','ship-state','ship-postal-code','ship-country', 'ship-phone-number','delivery-start-date','delivery-end-date','delivery-time-zone',"delivery-Instructions ") ); $order['28']='('.base64_encode($more[28]).')'; $order['29']='('.base64_encode($this->filetypearray['downloadfile'][28]).')';[28] => (ZGVsaXZlcnktSW5zdHJ1Y3Rpb25zDQ==)[29] => (ZGVsaXZlcnktSW5zdHJ1Y3Rpb25zIA==)两个字段的base64结果,最后部分不一样 那个DQ==是什么??我不加空格编码就是ZGVsaXZlcnktSW5zdHJ1Y3Rpb25z base64 编码的:DQ== 是回车符 0x0d (chr(13))IA== 是空格符 0x20 (chr(32))一般情况下首尾的空白字符是可忽略的,所以宜 trim 一下$ar = array_diff(array_map('trim', $array), array_map('trim', $value)); 求一个固定随机数的算法 今天又犯2了-我不是在犯2,就是在犯2的路上。 php新手问题 PHP怎样获取用户的IP地址 smarty模板问题 求windows下的php5加载mysql代码 请诸位推荐一些好的项目。 ThinkPHP 初级问题 调用Html thinkphp怎么多表插入 thinkphp5.0 html页面中 a标签 中href 链接 有变量 报错,各位大神 应该怎么解决? post文件中有一段代码很让我烦恼 定义这个函数为什么会出错
private function CheckFileType($array){
$type="";
foreach($this->filetypearray as $name=>$value){
$ar=array_diff($array,$value);
if(empty($ar)){
$type=$name;
}
}
return $type;
}private $filetypearray=array(
'downloadfile'=>array('order-id','order-item-id','purchase-date','payments-date','buyer-email',
'buyer-name','buyer-phone-number','sku','product-name','quantity-purchased','currency','item-price',
'item-tax','shipping-price','shipping-tax','ship-service-level','recipient-name','ship-address-1',
'ship-address-2','ship-address-3','ship-city','ship-state','ship-postal-code','ship-country',
'ship-phone-number','delivery-start-date','delivery-end-date','delivery-time-zone',"delivery-Instructions ")
);
$order['28']='('.base64_encode($more[28]).')';
$order['29']='('.base64_encode($this->filetypearray['downloadfile'][28]).')';[28] => (ZGVsaXZlcnktSW5zdHJ1Y3Rpb25zDQ==)
[29] => (ZGVsaXZlcnktSW5zdHJ1Y3Rpb25zIA==)
两个字段的base64结果,最后部分不一样
DQ== 是回车符 0x0d (chr(13))
IA== 是空格符 0x20 (chr(32))一般情况下首尾的空白字符是可忽略的,所以宜 trim 一下
$ar = array_diff(array_map('trim', $array), array_map('trim', $value));