日期:2014-05-17  浏览次数:20496 次

PHP出现Notice: Undefined variable: _U in 错误请高手指点!
急。。。。以下代码10行 、14行、32行等出现“Notice: Undefined variable: _U in ”错误,请高手指点。谢谢

1 <?php
2 if (!defined('ROOT_PATH')) die('不能访问');//防止直接访问
3 include_once("account.class.php");
4
5 if (isset($_POST['valicode']) && $_POST['valicode']!=$_SESSION['valicode']){
6 //if (1!=1){
7 $msg = array("验证码错误","",$_U['query_url']."/".$_U['query_type']);
8 }else{
9 $_SESSION['valicode'] = "";
10 if ($_U['query_type'] == "list"){
11
12 }
13
14 elseif ($_U['query_type'] == "log"){
15 $data['user_id'] = $_G['user_id'];
16 $data['page'] = $_U['page'];
17 $data['epage'] = 20;
18 $data['dotime1'] = isset($_REQUEST['dotime1'])?$_REQUEST['dotime1']:"";
19 $data['dotime2'] = isset($_REQUEST['dotime2'])?$_REQUEST['dotime2']:"";
20 $data['type'] = isset($_REQUEST['type'])?$_REQUEST['type']:"";
21 $result = accountClass::GetLogList($data);
22 if (is_array($result)){
23 $pages->set_data($result);
24 $_U['account_log_list'] = $result['list'];
25 $_U['show_page'] = $pages->show(3);
26 $_U['account_num'] = $result['account'];
27 }else{
28 $msg = array($result);
29 }
30 }
31
32 elseif ($_U['query_type'] == "cash"){
33 $data['user_id'] = $_G['user_id'];
34 $result = accountClass::GetUserLog($data);
35 $_U['cash_log'] = $result;
36 $data['page'] = $_U['page'];
37 $data['epage'] = $_U['epage'];
38 $result = accountClass::GetCashList($data);
39 if (is_array($result)){
40 $pages->set_data($result);
41 $_U['account_cash_list'] = $result['list'];
42 $_U['show_page'] = $pages->show(3);;
43 }else{
44 $msg = array($result);
45 }
46 }

------解决方案--------------------
可以把notice级别信息关闭。

要想全局的就在php.ini中 改为:error_reporting = E_ALL & ~E_NOTICE 。记得重启apache。

不想全局只想在当前页面生效。在脚本中加上:error_reporting(E_ALL^E_NOTICE);