我有两个文件。一个文件包含函数,另一个文件试图提取数据。
函数.php
<?php
function randomString() {
$str = "";
$characters = array_merge(range("A","Z"),range("a","z"),range("0","9"));
$max = count($characters) - 1;
for ($i=0; $i < $length='8'; $i++) {
$rand = mt_rand(0, $max);
$str .=$characters[$rand];
}
return $str;
}
?>
测试.php
<?php
randomString(); //i'm getting this error: Fatal error: Call to undefined function randomString() "FILE NAME HERE" on line 3
?>