duangangpin078794
2010-07-19 06:00
浏览 6
已采纳

如何在opencart中将变量从索引发送到控制器

I want to set a variable in index.php and want to access that variable in any controller of open cart.

图片转代码服务由CSDN问答提供 功能建议

我想在 index.php 中设置一个变量,并想要访问该变量 任何开放式推车的控制器。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doupai8095 2010-07-19 06:16
    已采纳

    i got it we can achieve this by declaring a public variable in controller.php in system/engine/controller.php and then u can access this variable in any controller by simply doing

    $this->variable_name = 'foo';
    
    打赏 评论
  • dongshuzui0335 2010-07-19 06:04

    I think what you are looking for is a session variable.

    $_SESSION['your Variable'] = "variable value";

    this way you can set it.

    You can get it by accessing.

    $var_value = $_SESSION['your Variable']

    打赏 评论

相关推荐 更多相似问题