0
Follow
0
View

Excuse me, why can't I run out here? Solution details must be adopted

cuiguoxing2008 注册会员
2023-02-27 12:17

If you are using a version of php7 or higher, this will not affect the warning. You should put the program in the xampp installation directory in a directory beginning with h, then go to 127.0.0.1/hello

dangxiaobo424 注册会员
2023-02-27 12:17
  • It tells you that the HelloWorld class is defined, not used;
// 你可以这样输出它
$helloworld = new HelloWorld();
echo $helloworld->index();
  • In addition to its index method, the return value type is not declared; You need to follow the method with the return value declaration
public function index() : string {
        return "index234";
}
czmike 注册会员
2023-02-27 12:17
dongfan_hr 注册会员
2023-02-27 12:17

This answer quotes ChatGPT

Please test this code


namespace app\controller;

class HelloWorld {
    public function index() {
        return 'index234';
    }
}


About the Author

Question Info

Publish Time
2023-02-27 12:17
Update Time
2023-02-27 12:17