今天下午试着把用PHP编写的经济学院新版网站上传到中南民族大学的服务器上,本来以为一切就OK了,没想到运行时遇到一大堆的错误提示。
  例如:
  Notice: Undefined index: delete in /home/economics/public_html/new/admin/news.php on line 22
  Notice: Undefined variable: pagehome in /home/economics/public_html/new/admin/news.php on line 548

  找到错误提示对应的代码行,$sort=$HTTP_GET_VARS["delete"];,代码书写没错,只不过取得的变量值是空值,因为我将许多功能集成在一个PHP文件中,在实现其它功能时才从表单给它赋值。
  思考了一下原因,我是在Windows+Apache2.0.52 (WINNT)+PHP5.0.0和Windows+IIS6.0+PHP5.0.0环境下编写、调试网站PHP程序的,而学校的服务器是Fedora Core(Linux)+Apache/2.0.52 (Fedora)+PHP4.3.9,不同版本不同运行环境下的PHP兼容性不好。试着在Fedora Core的前身Red Hat Linux 9的环境下运行经济学院网站的PHP程序,也没问题。看来就是学校服务器上的那个该死的Fedora Core惹的祸了。
  在网上寻找对策,一个解决方案是:“由于变量未定义引起的,打开php.ini,将;error_reporting = E_ALL & ~E_NOTICE前的分号去掉;如果你想关闭任何错误提示,打开php.ini,找到display_errors,设置为display_errors = Off,以后任何错误都不会提示。”但是我不可能去改学校服务器的php.ini配置吧,这个方案被我否定了。
  看来我只好从我的程序本身下手了,把类似$sort=$HTTP_GET_VARS["delete"];的换成if(isset($HTTP_GET_VARS["delete"])){$sort=$HTTP_GET_VARS["delete"];},作个判断,如果delete传递过来的表单值不为空,才执行后面获取表单值的语句。但在修改过程中发现,这种方法太麻烦,效果也不是很理想。突然,在PHP手册中搜索到函数error_reporting(0);官方解释是Turn off all error reporting,于是把error_reporting(0);加到PHP程序的首行,运行后果然没出现任何错误提示,终于解决了这个难题。

Tags:



电脑杂谈 | 评论(30) | 引用(0) | 阅读(39796)
shz Email
2022-7-16 18:01
Thank you very much for sharing such a useful article. Will definitely saved and revisit your site  online scams
shz Email
2022-7-16 18:05
Very educating story, saved your site for hopes to read more!  online scams
shz Email
2022-7-16 18:07
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.  online scams
shz Email
2022-7-16 18:10
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging,  online scams
shz Email
2022-7-16 18:14
I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one  online scams
hendy Email
2022-12-19 18:13
The article is very easy to understand, detailed and meticulous! I had a lot of harvest after watching this article from you! I find it interesting, your article gave me a new perspective! I have read many other articles on the same topic, but your article convinced me!  usps tracking number
jenxterai Email
2023-2-16 12:56
Discovering this page makes me happy. I want to thank you for your territorial io time and for this very excellent read. I have you set to my favorites to check at fresh material on your website. I absolutely liked every aspect of it.
Faith Morgan Email Homepage
2024-4-9 20:05
Absolutely thrilled with my refurbished phone! It's like finding a hidden tech treasure. Powerful device, amazing price, and the satisfaction of extending the life of a perfectly good gadget, helping the planet in the process.  Anyone else rocking a refurbished phone? Share your success stories and the fantastic deals you've found!  https://smartimobile.com
Sabina Holt Email
2024-5-1 15:34
Feel free about knowing something new on solar energy, solar power and, of course, solar panel pipkinelectric.compipkinelectric.com
oversized leather jacket Email Homepage
2025-6-19 23:05
You can purchase best <a href="https://masterpointleather.com/product/mens-cafe-racer-red-biker-leather-jacket/">red leather jacket</a>, <a href="https://masterpointleather.com/product/mens-vintage-red-leather-biker-jacket/">vintage red leather jacket mens</a>, <a href="https://masterpointleather.com/product/flipster-boy-fashion-leather-black-biker-jacket/">leather jacket</a>, <a href="https://masterpointleather.com/product-category/motorbike/vest/mens/">leather motorcycle vest for mens</a> and <a href="https://masterpointleather.com/product-category/motorbike/vest/womens/">leather motorcycle vest for womens</a>. Also <a href="https://oversizedleatherjacket.com/">oversized leather jacket</a>, You can get <a href="https://oversizedleatherjacket.com/product-category/men/">oversized leather jacket mens</a> and <a href="https://oversizedleatherjacket.com/product-category/women/">oversized leather jacket womens</a>Oversized leather offers best quality leather apparel for <a href="https://oversizedleatherjacket.com/product/new-york-oversized-leather-jacket/">90's womens black genuine oversized leather bomber jacket</a>, <a href="https://oversizedleatherjacket.com/product/womens-oversized-leather-jacket/">womens brown oversized leather bomber jacket</a>, <a href="https://oversizedleatherjacket.com/product/ohio-brown-oversize-leather-bomber-jacket/">womens vintage brown oversized leather bomber jacket</a>, <a href="https://oversizedleatherjacket.com/product/womens-vintage-oversized-leather-jackets/">womens brown vintage genuine oversized leather bomber jacket</a>, <a href="https://oversizedleatherjacket.com/oversized-leather-bomber-jacket-style/">oversized leather bomber jacket</a>, <a href="https://oversizedleatherjacket.com/vintage-oversized-leather-jacket-new-york/">vintage oversized leather jacket in new york</a> and <a href="https://oversizedleatherjacket.com/oversized-leather-jacket-new-york/">oversized leather jacket for mens and womens in new york</a>You can get best quality <a href="https://masterpointleather.com/product/motogp-honda-repsol-motorbike-leather-biker-suit/">Joan Mir HRC Honda Repsol 2023 Leather Motorbike Race Suit MotoGP</a>, <a href="https://masterpointleather.com/product/marquez-honda-repsol-motorbike-racing-suit/">Marc Marquez Honda Repsol Motorcycle Leather Biker Suit 2018 MotorGP</a>, <a href="https://masterpointleather.com/product/marc-honda-repsol-motorbike-leather-biker-suit/">Marc Marquez One Heart Honda Repsol Motorbike Leather Biker Suit</a>, <a href="https://masterpointleather.com/product/marquez-test-honda-repsol-leather-biker-suit/">Marc Marquez Test Honda Leather Biker Suit MotorGP</a>, <a href="https://masterpointleather.com/product/honda-repsol-motorbike-motorcycle-leather-suit/">MotoGP Honda Repsol Motorbike Leather Racing Suit</a>, <a href="https://masterpointleather.com/product/moster-energy-kawasaki-motorbike-suit/">MotoGP – Monster Energy Kawasaki Motorbike Leather Biker Racing Suit</a>, <a href="https://masterpointleather.com/product/monster-energy-yamaha-motorbike-leather-biker-racing-suit/">MotoGP – Monster Energy Yamaha Motorbike Biker Leather Racing Suit</a> and <a href="https://masterpointleather.com/product/repsol-honda-custom-motogp-motorbike-biker-racing-leather-suit/">Repsol Honda Custom MotoGP Motorbike Biker Racing Leather Suit</a>,
分页: 2/2 第一页 上页 1 2 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]