时间:2021-07-01 10:21:17 帮助过:23人阅读
把??txt??base64,再看看是否相同。
可以把你的代码粘贴出来吗???
需要看到你的代码和测试数据
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==)
那个DQ==是什么??我不加空格编码就是ZGVsaXZlcnktSW5zdHJ1Y3Rpb25z
base64 编码的:
DQ== 是回车符 0x0d (chr(13))
IA== 是空格符 0x20 (chr(32))
一般情况下首尾的空白字符是可忽略的,所以宜 trim 一下
$ar = array_diff(array_map('trim', $array), array_map('trim', $value));