Undefined index 错误

youyiyang 2017-07-19 08:37:14
大神们,好!

我在改别人写的代码的时候碰到这些错误,请问这主要是什么地方出错了?我是php菜鸟,代码是用Smarty写的。附上一些截图请看。

Notice: Undefined index: mod_rewrite in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\common.php on line 45

Notice: Undefined index: mainsite in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\common.php on line 55

Notice: Constant ATL_DEPOLYMENT already defined in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\common.php on line 85

Notice: Undefined index: path in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\common.php on line 18

Notice: Undefined index: path in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\common.php on line 19

Notice: Undefined variable: strOrderField in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\functions.php on line 834

Notice: Undefined variable: order in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\functions.php on line 834

Notice: Undefined variable: Start in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\functions.php on line 834

Notice: Undefined variable: PerPage in D:\TheGlobalCrosswalk\myatlasconnect\html\includes\functions.php on line 834
...全文
670 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
君King 2017-07-21
  • 打赏
  • 举报
回复
这种是不影响程序正常运行的, 1.你可以在php配置文件中设置错误级别,屏蔽掉这些错误 2.可以在对应的文件中设置 error_reporting("ERROR_ALL^ERROR_NOTICE");
youyiyang 2017-07-20
  • 打赏
  • 举报
回复
我在index.php上面这么写第一行,

<?php
    error_reporting(0);
	ob_start();
	session_start();

	include "includes/common.php";	
	
	error_reporting(E_ALL ^ (E_NOTICE|E_WARNING));
	
	$_SESSION["ses_uid"] = trim($_SESSION["ses_uid"]);
	if(isset($_SESSION["ses_uid"]) && !empty($_SESSION["ses_uid"])) {
		header("location: dashboard.php");
	}
	if($_REQUEST['redirect_url'] != '') {
		$objSmarty->assign("redirect_url",urlencode($_REQUEST['redirect_url']));
	}
	$objauthentication = new authentication(); 
	switch($_POST['hdAction']) {
		case 'login':
			$objauthentication->admin_login_check($_POST['txtloginname'],$_POST['txtloginpassword'],$_REQUEST);
			$objSmarty->assign("txtloginname", $_POST["txtloginname"]);
			break;	
	}
	$objSmarty->display("index.tpl");
?>

php.ini改写这样; ; http://php.net/error-reporting error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; This directive controls whether or not and where PHP will output errors, 重启apache和mysql,还是这样,没有变化
一起混吧 2017-07-20
  • 打赏
  • 举报
回复
更改错误级别恐怕治标不治本,还是检查一下代码,看哪里弄错了。 单从错误信息来看,是不是你配置文件没有引入。
果酱很好吃 2017-07-20
  • 打赏
  • 举报
回复
notice 级别的错误可以关闭 1、在php.ini文件中找到 error_reporting 改为: error_reporting=E_ALL & ~E_NOTICE 2、或者在程序入口文件处(或文件顶部)写入 error_reporting(E_ALL^E_NOTICE);
hongmei85 2017-07-19
  • 打赏
  • 举报
回复
刚学习PHP,不久,一般就看看手册,和一本叫PHP和mysql web开发的。 最近在整留言板,刚才遇到个问题。 页面中,好多类似 Notice: Use of undefined constant title - assumed 'title' in D:\wamp\www\phpmysqlweb\bbs\list.php on line 17 页面很难看,很纠结啊,我用的是wamp集成包。 百度了下,看来好多朋友也有这个情况。 Notice意思是使用了没有被声明的变量,但是程序不会影响使用。难怪还是能正常运行的,就是不雅观。 解决办法有4个: 1:在上面初始化 2:打开php.ini文件 修改配置文件 error_reporting设置: 找到error_reporting=E_ALL 修改为error_reporting=E_ALL & ~E_NOTICE 3:用include把 error_reporting(E_ALL & ~E_NOTICE);写进去 //天空就是这么干的,因为是个懒人,怕打开这个那个,嘻嘻。。。。。 4:直接在文件最上面加个error_reporting(0);

4,251

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧