function foo(string $s) {
echo $s;
}
foo("hello world");
报错Catchable fatal error: Argument 1 passed to foo() must be an instance of string, string given, called in
这是为什么?应该怎么写呢?
...全文
1135打赏收藏
string 类型约束的问题
function foo(string $s) { echo $s; } foo("hello world"); 报错Catchable fatal error: Argument 1 passed to foo() must be an instance of string, string given, called in 这是为什么?应该怎么写呢?