首頁 後端開發 php教程 php Undefined index和Undefined variable的解决方法_php技巧

php Undefined index和Undefined variable的解决方法_php技巧

May 17, 2016 am 09:37 AM
index undefined variable

$act=$_POST['act'];

用以上代码总是提示
Notice: Undefined index: act in F:\windsflybook\post.php on line 18

另外,有时还会出现

 引用内容
Notice: Undefined variable: Submit ......

等一些这样的提示

原因:由于变量未定义引起的

解决方法:
1) error_reporting设置:
找到error_reporting = E_ALL
修改为error_reporting = E_ALL & ~E_NOTICE

2) register_globals设置:
找到register_globals = Off
修改为register_globals = On

Notice: Undefined variable: email in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
  Notice: Undefined variable: subject in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
  Notice: Undefined variable: comment in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9
  ........
  本来php是不需要定义变量的,但是出现这种情况应该怎么办呢?
  只要在C:\WINDOWS找出php.ini的
  在php.ini中的302行 error_reporting = E_ALL
  修改成
  error_reporting = E_ALL & ~E_NOTICE再重启apache2.2就行了
  解决方法:修改php.ini
  将: error_reporting = E_ALL
  修改为:error_reporting = E_ALL & ~E_NOTICE
  如果什么错误都不想让显示,直接修改:
  display_errors = Off
  如果你没有php.ini的修改权限,可在php头部加入
  ini_set("error_reporting","E_ALL & ~E_NOTICE");
  即可

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

index.html是什麼文件? index.html是什麼文件? Feb 19, 2024 pm 01:36 PM

index.html是什麼文件?

Vue中的TypeError: Cannot read property '$XXX' of undefined,該如何處理? Vue中的TypeError: Cannot read property '$XXX' of undefined,該如何處理? Nov 25, 2023 pm 12:14 PM

Vue中的TypeError: Cannot read property '$XXX' of undefined,該如何處理?

PHP Notice: Undefined property: 的解決方法 PHP Notice: Undefined property: 的解決方法 Jun 22, 2023 pm 02:48 PM

PHP Notice: Undefined property: 的解決方法

undefined和null是什麼意思 undefined和null是什麼意思 Nov 20, 2023 pm 02:39 PM

undefined和null是什麼意思

undefined是什麼 undefined是什麼 Jul 31, 2023 pm 02:28 PM

undefined是什麼

如何解決 golang 中的 'undefined: path.Join” 錯誤? 如何解決 golang 中的 'undefined: path.Join” 錯誤? Jun 24, 2023 pm 01:12 PM

如何解決 golang 中的 'undefined: path.Join” 錯誤?

null和undefined有什麼不同 null和undefined有什麼不同 Nov 08, 2023 pm 04:43 PM

null和undefined有什麼不同

什麼時候用null和undefined 什麼時候用null和undefined Nov 13, 2023 pm 02:11 PM

什麼時候用null和undefined

See all articles