1、怎样通过百度站长工具上传xml文件
public byte[] getFileAsByte(File file) throws Exception{
if(file == null) {
return null;
}
FileInputStream fis= new FileInputStream(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream(4096);
byte[] b = new byte[4096];
int n;
while((n = fis.read(b)) >0) {
bos.write(b, 0, n);
}
bos.close();
fis.close();
return bos.toByteArray();
}
2、百度分享代码能不能放在JS文件里面调用,我把百度分享代码用站长工具转换成JS格式以后,调用了没有效果
可以放,我测试了的,不过只有ie支持别的浏览器不支持, document.write('<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare" style="float:right;margin-top:-30px;*margin-top:-5px;margin-right:30px;">');
document.write('<a class="bds_qzone"></a>');
document.write('<a class="bds_tsina"></a>');
document.write('<a class="bds_tqq"></a>');
document.write('<a class="bds_renren"></a>');
document.write('<span class="bds_more">更多</span>');
document.write('<a class="shareCount"></a></div>');
document.write('<script type="text/javascript" id="bdshare_js" data="type=tools&uid=772334" ></script>');
document.write('<script type="text/javascript" id="bdshell_js"></script>');
document.getElementById("bdshell_js").src = " http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + new Date().getHours();