PHP 同名变量 [英] PHP Variables with the same name

查看:34
本文介绍了PHP 同名变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我用 PHP 制作的登录系统与 PHPBB 登录系统集成.我的问题是我包含的 PHP 登录文档包含一个名为 $user 的类,但我的登录系统也使用 $user .例如,我的登录函数在名为 $user 的类中执行,而 phpbb 登录类是 $user->login

I am trying to integrate my login system made with PHP with the PHPBB Login system. My problem is that I am including the PHP login document which contains a class called $user but my login system uses $user as well. e.g My function for login is executing inside a class called $user and the phpbb login class is $user->login

是否可以加载 phpbb 文档,并在一种单独的环境"中登录到我的主网站?

Is it possible to load the phpbb document, and login in a separate kind of "environment" to my main website?

如果您需要更多信息,请告诉我

If you need any more info just let me know

推荐答案

您可以在函数中运行您的代码.如果您不明确告诉函数,则不会传递全局变量;)

You could run your code in a function. Functions aren't passed global variables if you don't explicitly tell them ;)

这篇关于PHP 同名变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆