Use URL: http://www.tp51.com/index/Demo/test/name=peter&sex=male
class Demo extends Controller
{
public function test()
{
dump((new Request())->get()); //Equivalent to dump($_GET);
Output:
'/index/Demo3/test1/name' => string 'peter' (length=5)
'sex' => string 'male' (length=4)
## dump((new Request())->param('name')); . /male
}
}
In addition, the same code can be accessed using the following method:
URL: http://www.tp51. com/index/Demo/test?name=peter&sex=male
Copy code
Output:
array (size=3)
'/index /Demo/test' => string '' (length=0)
'name' => string 'peter' (length=5)
'sex' => string The 'male' (length=4)
param() method outputs correctly.
Please ask the teacher and all the heroes to help guide me. Is there a problem with the parameter setting or the code?
Thanks!
Also, Thinkphp URL passes parameters through / or ? Please provide guidance on the problem.
Many thanks!
In addition, I have not changed the core module and configuration file information of PHP5.1.
Is there something wrong with your link? http://www.tp51.com/index/Demo/test/name=peter&sex=male. Don’t you have to use the ampersand in front of it? Then you can splice & with parameters later.