Home Backend Development PHP Tutorial 各位大家帮忙看一下哪里出了有关问题

各位大家帮忙看一下哪里出了有关问题

Jun 13, 2016 am 10:08 AM
char do function quot return

各位大家帮忙看一下哪里出了问题
这个为什么没办法输出

代码如下:

require('web.config.php');
return_lang();
$do = $_GET['do'];
$g = chr(92);
$do = str_replace($g , "", $_GET['do']);
$do = str_replace("/" , "", $do);
$do = str_replace("%00" , "\0", $do);
$do = str_replace("?" , "", $do);
$do = htmlspecialchars($do);
$do = strtolower($do);
if(!isset($_GET['do'])){ jump('extend.php?do=webreborn'); } else {
if($user_auth->haslogin(true)){
$rs = $db->Execute("Select * from userinfo where userid = ?", array($_SESSION['auth_user']));
$auth = $rs->GetArray();
$auth = $auth[0];

class char_do extends Member {

var $inputs = array('ChaList','id','cid','SchoolList');
var $stn_rb = false;
var $vip_rb = false;

function char_do(){
global $do,$db,$auth,$_config;
if (!is_file("modules/user.".$do.".php")) { jump('ErrorPage.php'); }
switch ($do) {


case 'webpd':
include('modules/user.webpd.php');
$titleImg = "title_37";
break;


//You can add more page here.....

}
}

function _char_select_empty(){
if($_POST[$this->inputs[0]]!="-1"){
return true;
}
return false;
}
function _school_select_empty(){
if($_POST[$this->inputs[3]]!="-1"){
return true;
}
return false;
}
function _update_rb_lvl_exp($db,$id){
global $_config;
$rb_res = $db->Execute('update rangame1.dbo.chainfo set '.$_config['ucp_rb_col'].'='.$_config['ucp_rb_col'].'+?, ChaLevel = ?, chaexp = ? where chanum = ?',array('1','1','0',$id));
if($rb_res){
return true;
}
return false;
}
function _charge_gold($db,$id,$cost){
$gold_res = $db->Execute('update rangame1.dbo.chainfo set ChaMoney = ChaMoney - ? where chanum = ?',array($cost,$id));
if($gold_res){
return true;
}
return false;
}
function resetRbStats($db,$id){
$char_res = $db->Execute('Update RanGame1.dbo.ChaInfo set ChaPower=?,ChaStrong=?,ChaStrength=?,ChaSpirit=?,ChaDex=?,ChaStRemain=? where chanum = ?',array(0,0,0,0,0,0,$id));
if($char_res){
return true;
}
return false;
}
function _update_rb_stats($db,$cid,$stats,$rev=false){
if($rev==true){
$stn_res = $db->Execute('update rangame1.dbo.chainfo set ChaStRemain = ChaStRemain + ? where chanum = ?',array($stats,$cid));
}else{
$stn_res = $db->Execute('update rangame1.dbo.chainfo set ChaStRemain = ? where chanum = ?',array($stats,$cid));
}
if($stn_res){
return true;
}
return false;
}
function _char_list(){
global $db,$auth;
$char_list = $db->Execute("SELECT UserNum,ChaNum,ChaName FROM RanGame1.dbo.ChaInfo Where ChaDeleted!=1 And UserNum = ?",array($auth['UserNum']));
if($char_list->EOF)
echo '';
foreach ($char_list as $char => $c) {
$temp_c = 'if(clean_variable($_POST[$this->inputs[0]])==$c["chanum"]){
$temp_c.= 'selected="selected" ';
}
$temp_c.= 'value="'.$c["chanum"].'">';
$temp_c.= $c["chaname"];
$temp_c.= '';

echo $temp_c;
}
}
}
$char_func = new char_do;
?>

在这里调用 为什么无法输出?

------解决方案--------------------
$titleImg,作用域
------解决方案--------------------
$titleImg 在 function char_do 中定义,并未声明为全局变量
只有 global $do,$db,$auth,$_config;

所以无法在外部访问

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Detailed explanation of the usage of return in C language Detailed explanation of the usage of return in C language Oct 07, 2023 am 10:58 AM

The usage of return in C language is: 1. For functions whose return value type is void, you can use the return statement to end the execution of the function early; 2. For functions whose return value type is not void, the function of the return statement is to end the execution of the function. The result is returned to the caller; 3. End the execution of the function early. Inside the function, we can use the return statement to end the execution of the function early, even if the function does not return a value.

What does function mean? What does function mean? Aug 04, 2023 am 10:33 AM

Function means function. It is a reusable code block with specific functions. It is one of the basic components of a program. It can accept input parameters, perform specific operations, and return results. Its purpose is to encapsulate a reusable block of code. code to improve code reusability and maintainability.

What is the execution order of return and finally statements in Java? What is the execution order of return and finally statements in Java? Apr 25, 2023 pm 07:55 PM

Source code: publicclassReturnFinallyDemo{publicstaticvoidmain(String[]args){System.out.println(case1());}publicstaticintcase1(){intx;try{x=1;returnx;}finally{x=3;}}}#Output The output of the above code can simply conclude: return is executed before finally. Let's take a look at what happens at the bytecode level. The following intercepts part of the bytecode of the case1 method, and compares the source code to annotate the meaning of each instruction in

What is the purpose of the 'enumerate()' function in Python? What is the purpose of the 'enumerate()' function in Python? Sep 01, 2023 am 11:29 AM

In this article, we will learn about enumerate() function and the purpose of “enumerate()” function in Python. What is the enumerate() function? Python's enumerate() function accepts a data collection as a parameter and returns an enumeration object. Enumeration objects are returned as key-value pairs. The key is the index corresponding to each item, and the value is the items. Syntax enumerate(iterable,start) Parameters iterable - The passed in data collection can be returned as an enumeration object, called iterablestart - As the name suggests, the starting index of the enumeration object is defined by start. if we ignore

Detailed explanation of the role and function of the MySQL.proc table Detailed explanation of the role and function of the MySQL.proc table Mar 16, 2024 am 09:03 AM

Detailed explanation of the role and function of the MySQL.proc table. MySQL is a popular relational database management system. When developers use MySQL, they often involve the creation and management of stored procedures (StoredProcedure). The MySQL.proc table is a very important system table. It stores information related to all stored procedures in the database, including the name, definition, parameters, etc. of the stored procedures. In this article, we will explain in detail the role and functionality of the MySQL.proc table

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

How does Vue3 use setup syntax sugar to refuse to write return How does Vue3 use setup syntax sugar to refuse to write return May 12, 2023 pm 06:34 PM

Vue3.2 setup syntax sugar is a compile-time syntax sugar that uses the combined API in a single file component (SFC) to solve the cumbersome setup in Vue3.0. The declared variables, functions, and content introduced by import are exposed through return, so that they can be used in Vue3.0. Problems in use 1. There is no need to return declared variables, functions and content introduced by import during use. You can use syntactic sugar //import the content introduced import{getToday}from'./utils'//variable constmsg='Hello !'//function func

The usage and function of Vue.use function The usage and function of Vue.use function Jul 24, 2023 pm 06:09 PM

Usage and Function of Vue.use Function Vue is a popular front-end framework that provides many useful features and functions. One of them is the Vue.use function, which allows us to use plugins in Vue applications. This article will introduce the usage and function of the Vue.use function and provide some code examples. The basic usage of the Vue.use function is very simple, just call it before Vue is instantiated, passing in the plugin you want to use as a parameter. Here is a simple example: //Introduce and use the plug-in

See all articles