fetch_array($rel)) { foreach ($row as $key => $value) { $uinfo[$key] = $v"/> fetch_array($rel)) { foreach ($row as $key => $value) { $uinfo[$key] = $v">

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

WBOY
Release: 2016-06-02 11:32:47
Original
1086 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
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!