小编Red*_*sco的帖子

在销毁函数 Laravel 中尝试 Catch 方法

当您在数据库中没有要删除的内容时,我尝试显示一条消息,而不是显示一个错误,表明您有一个空值

public function destroy($customer_id)
 {

    $customer_response = [];
    $errormsg = "";

    $customer = Customer::find($customer_id);
    $result = $customer->delete();
    try{
    //retrieve page
      if ($result){
          $customer_response['result'] = true;
          $customer_response['message'] = "Customer Successfully Deleted!";

      }else{
          $customer_response['result'] = false;
          $customer_response['message'] = "Customer was not Deleted, Try Again!";
      }
      return json_encode($customer_response, JSON_PRETTY_PRINT);

    }catch(\Exception $exception){
      dd($exception);
        $errormsg = 'No Customer to de!' . $exception->getCode();

    }

    return Response::json(['errormsg'=>$errormsg]);
  }
Run Code Online (Sandbox Code Playgroud)

与我之前的商店功能相比,try/catch 方法不起作用

php try-catch laravel

0
推荐指数
1
解决办法
3389
查看次数

期望的标识符char JOPtion

        m = input.length();

        char[]sort = new.char [m];
        input = JOptionPane.showInputDialog("Please Selecet [A/D]:");
        for (s = 0; 3<m; s++)
        {
            if(sort[a] = input.charAt(a));
        }
        if (input.charAt(0) == 'A' || input.charAt(0) == 'a');
        {
Run Code Online (Sandbox Code Playgroud)

我一直在收到错误:

>char[]sort = new.char [m]; 
Run Code Online (Sandbox Code Playgroud)

...说"行标识符预期".

你能不能请求帮助,我似乎无法让它运行起来.

java char

-2
推荐指数
1
解决办法
58
查看次数

标签 统计

char ×1

java ×1

laravel ×1

php ×1

try-catch ×1