缺少参数 &未定义的变量;错误的原因是什么?
我收到以下错误,我问是否有人知道我会收到这些错误的可能原因。我是新手,所以帮助将不胜感激...... 我还将发布有问题的行。
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Welcome::quote()
Filename: controllers/welcome.php
Line Number: 64
以及
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: productid
Filename: controllers/welcome.php
Line Number: 65
有问题的线路;
64 function quote($productid){
65 if ($productid > 0){
66 $fullproduct = $this->MProducts->getProduct($productid);
67 $this->MQuotes->updateQuote($productid,$fullproduct);
68 redirect('welcome/product/'.$productid, 'refresh');
69 }else{
70 $data['title'] = '... | Quote';
..
.. if (count($_SESSION['quote']) == true){
.. $data['main'] = 'quote';
.. $data['navlist'] = $this->MCats->getCategoriesNav();
.. $this->load->vars($data);
.. $this->load->view('template');
.. }else{
.. redirect('welcome/index','refresh');
.. }
.. }
.. }
$productid 有什么问题吗?
I am receiving the following errors, I'm asking if anyone knows a possible reason why I would get these. I am newbish so help would be grateful...
I will also post the lines in question.
A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Welcome::quote()
Filename: controllers/welcome.php
Line Number: 64
and
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: productid
Filename: controllers/welcome.php
Line Number: 65
The lines in question;
64 function quote($productid){
65 if ($productid > 0){
66 $fullproduct = $this->MProducts->getProduct($productid);
67 $this->MQuotes->updateQuote($productid,$fullproduct);
68 redirect('welcome/product/'.$productid, 'refresh');
69 }else{
70 $data['title'] = '... | Quote';
..
.. if (count($_SESSION['quote']) == true){
.. $data['main'] = 'quote';
.. $data['navlist'] = $this->MCats->getCategoriesNav();
.. $this->load->vars($data);
.. $this->load->view('template');
.. }else{
.. redirect('welcome/index','refresh');
.. }
.. }
.. }
what's wrong with $productid??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这意味着您没有在网址中传递所需数量的段
您似乎在请求:
如果您希望能够在没有错误的情况下访问后者,请给它一个默认值:
然后您可以执行以下操作:
但是,如果您传递了所需数量的段,请更新问题以包含您的内容
/config/routes.php
文件(假设您已编辑它)。It means you're not passing the required amount of segments in your URL
It seems you're requesting:
If you want to be able to access the latter without an error, give it a default value:
and then you can do:
If you are passing the required amount of segments however, update the question to include the contents of your
/config/routes.php
file (assuming you've edited it).