<?php
header ( 'Content-type:text/html;charset=utf-8' );
/**
 * 对图片进行base64编码（综合认证平台使用）
 * @param unknown $path
 * @return boolean|string
 */
  function enCodeFileContent4Zhrz($path){
	$file_content_base64 = '';
	if(!file_exists($path)){
		echo '文件没找到';
		return false;
	}

	$file_content = file_get_contents ( $path );
	//UTF8 去掉文本中的 bom头
	$BOM = chr(239).chr(187).chr(191);
	$file_content = str_replace($BOM,'',$file_content);
	$file_content_base64 = base64_encode ( $file_content );
	return $file_content_base64;
}
/**
 * 打印请求应答
 *
 * @param
 *        	$url
 * @param
 *        	$req
 * @param
 *        	$resp
 */
function printResult($url, $req, $resp) {
	echo "=============<br>\n";
	echo "地址：" . $url . "<br>\n";
	echo "请求：" . str_replace ( "\n", "\n<br>", htmlentities ( com\unionpay\acp\sdk\createLinkString ( $req, false, true ) ) ) . "<br>\n";
	echo "应答：" . str_replace ( "\n", "\n<br>", htmlentities ( com\unionpay\acp\sdk\createLinkString ( $resp , false, false )) ) . "<br>\n";
	echo "=============<br>\n";
}

?>