fetch_array($rel)) { foreach ($row as $key => $value) { $uinfo[$key] = $v"/> fetch_array($rel)) { foreach ($row as $key => $value) { $uinfo[$key] = $v">
Home > Backend Development > PHP Tutorial > php-PHP中include后,函数中需要global部分变量

php-PHP中include后,函数中需要global部分变量

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-02 11:32:47
Original
1139 people have browsed it

php

PHP中include后,部分函数中需要global部分变量,例如下面global $db;问,如果不用global,怎么完美解决

/*

  • 功能:检测用户登录
  • 参数:
  • 返回:boolen/function check_login() {if(isset($_SESSION['shell'])==false) return false;* global $db;**$uid = $_SESSION['uid'];$rel = $db->findall('members', "WHERE uid='" . $uid . "'");while ($row = $db->fetch_array($rel)) { foreach ($row as $key => $value) { $uinfo[$key] = $value; }}$ushell = md5($uinfo['password'] . $uinfo['role'] . DSLOG_ENC);if ($ushell == $_SESSION['shell']) { return true;} else { return false;}}?>
Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template