【发布时间】:2016-03-22 17:18:50
【问题描述】:
我有以下代码:
Array
(
[title] => asdas
[question] => dasdsa
[gender] =>
[age] =>
[description] =>
[imageUrl] =>
[plan_id] => 2
[plan_type] => special
[plan_price] => 199
[specialty_id] => 7
[specialty] => Cardiologist
)
我在专业方面遇到错误:
Error
RedBeanPHP\RedException Object
(
[message:protected] => Cannot cast to bean.
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /Applications/XAMPP/xamppfiles/htdocs/site/rb/rb.php
[line:protected] => 2203
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /Applications/XAMPP/xamppfiles/htdocs/site/rb/rb.php
[line] => 2414
[function] => __set
[class] => RedBeanPHP\OODBBean
[type] => ->
[args] => Array
(
[0] => specialty
[1] => asdsad
)
)
[1] => Array
(
[file] => /Applications/XAMPP/xamppfiles/htdocs/site/class/crud.php
[line] => 52
[function] => offsetSet
[class] => RedBeanPHP\OODBBean
[type] => ->
[args] => Array
(
[0] => specialty
[1] => asdsad
)
)
[2] => Array
(
[file] => /Applications/XAMPP/xamppfiles/htdocs/site/validate/question/step2.php
[line] => 37
[function] => insert
[class] => crud
[type] => ->
[args] => Array
(
[0] => question
[1] => Array
(
[title] => asdas
[question] => dasdsa
[gender] =>
[age] =>
[description] =>
[imageUrl] =>
[plan_id] => 2
[plan_type] => special
[plan_price] => 199
[specialty_id] => 7
[specialty] => asdsad
[contributor] => dinesh
[created_by] => 1
[ip_address] => ::1
[user_agent] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10; rv:33.0) Gecko/20100101 Firefox/33.0
)
)
)
)
[previous:Exception:private] =>
)
我花了 1 个多小时试图解决这个问题,但我仍然无法解决它。
【问题讨论】:
-
假设你的代码是 PHP,你需要用括号括起来字符串,不是吗?还向我们展示
2203的rb.php行吗? -
这是我的参数数组 ( [title] => asdas [question] => dasdsa [gender] => [age] => [description] => [imageUrl] => [plan_id] = > 2 [plan_type] => special [plan_price] => 199 [specialty_id] => 7 [specialty] => 心脏病专家)
-
如果您删除了专业参数,它可以正常工作。
-
你试过用括号括起来你的字符串并添加逗号吗?你得到的错误我不清楚。
Array ( [title] => "asdas", [question] => "dasdsa", [gender] => "", [age] => "", [description] => "", [imageUrl] => "", [plan_id] => 2, [plan_type] => "special", [plan_price] => 199, [specialty_id] => 7, [specialty] => "Cardiologist" ); -
我试过了。专业问题。