为什么函数限定了参数类型就会报错?

$path=read_directory('webroot');


function read_directory(string $path){

}

为什么会出现这种错误 如果去掉string就没问题了

Catchable fatal error:  Argument 1 passed to read_directory() must be an instance of string, string given, called in D:\phpStudy\WWW\filesys\index.php on line 4 and defined in D:\phpStudy\WWW\filesys\lib\dir.func.php on line 2


慕桂英4528887
浏览 1101回答 1
1回答

冰封灬尘世

!!!
打开App,查看更多内容
随时随地看视频慕课网APP