21,887
社区成员
发帖
与我相关
我的任务
分享
function bstr2bin($input)
// Binary representation of a binary-string
{
if (!is_string($input)) return null; // Sanity check
// Unpack as a hexadecimal string
$value = unpack('H*', $input);
// Output binary representation
$value = str_split($value[1], 1);
$bin = '';
foreach ($value as $v)
{
$b = str_pad(base_convert($v, 16, 2), 4, '0', STR_PAD_LEFT);
$bin .= $b;
}
return $bin;
}
<?php
$file=file('link.txt');
$max=count($file)-1;
for($i=0;$i<5;$i++){
$index=mt_rand(0,$max);
echo "<a href='http://www.qq.com'>".$file["$index"]."</a><br>";
}
?>