STM32

在我的颤振应用程序中,我有两个页面来显示和添加/编辑一些数据。我正在使用提供者和消费者构造函数,但是当我添加或编辑数据并导航回显示我的数据的页面时,它们没有被更新。

Provider 函数正在获取数据,但我猜 php 端有一些问题。当 get 请求第一次到达 php 文件时,它会检查 key。

if (array_key_exists("parentid", $_GET)&&array_key_exists("moduleid", $_GET)) 

然后我这样分离请求方法:

if($_SERVER['REQUEST_METHOD'] === 'GET') {..}
if($_SERVER['REQUEST_METHOD'] === 'DELETE') {..}

这是完整的代码:

图片[1]-STM32-唐朝资源网

if (array_key_exists("parentid", $_GET)&&array_key_exists("moduleid", $_GET)) {
error_log("This condition work fine");
$parentid = $_GET['parentid'];
$moduleid = $_GET['moduleid'];
if($parentid == '' || !is_numeric($parentid)) {

$response = new Response();
$response->setHttpStatusCode(400);
$response->setSuccess(false);
$response->addMessage("Parent ID cannot be blanck or must be numeric");
$response->send();
exit;
}
if($moduleid == '' || !is_numeric($moduleid)) {

图片[2]-STM32-唐朝资源网

$response = new Response(); $response->setHttpStatusCode(400); $response->setSuccess(false); $response->addMessage("Module ID cannot be blanck or must be numeric"); $response->send(); exit; }

图片[3]-STM32-唐朝资源网

if($_GET) { error_log("here we stack"); try { $querySetNames = $readDB->prepare("SET NAMES 'utf8'"); $querySetNames->execute(); $query = $readDB->prepare('SELECT ... } if($_SERVER['REQUEST_METHOD'] === 'DELETE') {..} if($_SERVER['REQUEST_METHOD'] === 'PATCH') {..} }

我尝试使用 if($_SERVER[‘REQUEST_METHOD’] == ‘GET’) {..} 和 if($_SERVER[‘REQUEST_METHOD’] === ‘GET’) {..} 而不是 if( $_GET)。但它没有用。

因此,我无法获得更新的数据。可能是什么原因

© 版权声明
THE END
喜欢就支持一下吧
点赞232赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容