未捕获错误:在null上调用成员函数post()

时间:2017-12-10 03:29:59

标签: php slim

您好我遇到了这种错误

  

“未捕获错误:在null”

上调用成员函数post()

有人介意指导我如何使这段代码有效吗?

提前致谢!

$app->post('signup', function() {
$app = \Slim\Slim::getInstance();
$name = $app->request()->post('name');
$surname = $app->request()->post('surname');
$address = $app->request()->post('address');
$contactno = $app->request()->post('contactno');
$username = $app->request()->post('username');
$password = $app->request()->post('password');
$app->response->setStatus(500);
$app->response()->headers->set('Content-Type', 'application/json');
try
{
$db = getDB();
$sth = $db->prepare("select count(*) as count from resident WHERE 
username=:username");
$sth->bindParam(':username', $username, PDO::PARAM_INT);
$sth->execute();
$row = $sth->fetch();

0 个答案:

没有答案