You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
wastesortingserver/test.php

51 lines
1.4 KiB

<?php
//require_once $_SERVER["DOCUMENT_ROOT"] ."/config.php";
//require_once $_SERVER["DOCUMENT_ROOT"] . "/database/DbUtil.php";
//require_once $_SERVER["DOCUMENT_ROOT"] . "/entity/Question.php";
//require_once $_SERVER["DOCUMENT_ROOT"] . "/entity/Answer.php";
//require_once $_SERVER["DOCUMENT_ROOT"] . "/Log.php";
//echo <<<EOF
//<html>
//<head>
//<meta charset="utf-8">
//<title>菜鸟教程(runoob.com)</title>
//</head>
//<body>
//
//<form action="/api/BaiduImage.php" method="post" enctype="multipart/form-data">
// <label for="file">文件名:</label>
// <input type="file" name="file" id="file"><br>
// <input type="submit" name="submit" value="提交">
//</form>
//
//</body>
//</html>
//EOF;
//var_dump(array_search(new Answer(1, 2, 3, 4), array(new Answer(4, 5, 6, 7), new Answer(2, 2, 3, 4))));
//$s1 = "dotcoo world!";
//$s2 = "dotcoo";
//$s3 = "hello dotcoo";
//var_dump(substr($s1, -strlen($s2)) === $s2);
/*
* 生成随机字符串
* @param int $length 生成随机字符串的长度
* @param string $char 组成随机字符串的字符串
* @return string $string 生成的随机字符串
*/
function str_rand($length = 32, $char = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
if(!is_int($length) || $length < 0) {
return false;
}
$string = '';
for($i = $length; $i > 0; $i--) {
$string .= $char[mt_rand(0, strlen($char) - 1)];
}
return $string;
}
var_dump(str_rand(5));