duan198409 2014-03-25 09:07
浏览 28
已采纳

将变量传递到OOP框架中的另一个文件

I'm a relative newbie at PHP and OOP in general, and I have a questions relating to them.

I have two php files in different folders, in an OOP structured framework. This is the folder structure with their real names:

file1:

garratt/modules/garrattcustom/classes/garrattcustom_module.php

file2a:

garratt/themes/la_boutique_lite/pages/page_pay.php

File 2b:

garratt/themes/la_boutique_lite/pages/page_delayed_payment.php

file1 (garrattcustom_module.php) contains variables which is getting passed to file2a (page_pay.php), and I can use them there (I checked using isset() that they exist in that file). However in file2b (page_delayed_payment.php) which is in the same directory isn't getting those variables. Neither of file2a and file2b have codes that seem to get variable from file1 (like sessions or includes). How is file1 getting the variables across to file2a? I would post file1's contents but it's about 600 lines long. Does anyone have any idea what might be going on, and suggestion on what kind of code I should look for in file1 that might be doing it?

For those of you who know of it, I'm using Lemonstand eCommerce framework.

Thank you

  • 写回答

1条回答 默认 最新

  • douchui4815 2014-03-25 09:34
    关注

    Maybe this values are fed from a form thus using $_POST is very appropriate.

    You could just do :

    $_POST['myPay'] -> this method fetches the value of a form element with a name myPay.

    Or

    Another method would be by $_SESSION, you could add a session variable that holds the values you want to fetch.

    NOTE: I recommend not to use $_GET (It is very manipulative)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?