php 5和未初始化的变量 [英] php 5 and uninitialized variables

查看:84
本文介绍了php 5和未初始化的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个包含页面,负责构建基本布局

我的网页(标题,菜单等)。每个页面都包含这个

" sysheader.php"。

我用这个标题构建的第一页有奇怪的结果。它的工作是

将用户添加到系统中。我期望的变量有:id,

userName,密码......这样的东西。在require_once

" sysheader.php"之后,我已经放了一个退出;声明。标题显示完美。

如果我尝试访问或设置其中一个预期的变量,只有部分

标题显示...在它的时间周围徘徊建立公司

徽标 - 这样我就可以看到< img src =" http:// www"没有别的。


我试图设置我自己的变量顺序并自己初始化变量

像这样:

$ id =(isset($ _ POST [''id''])?$ _POST [''id'']:$ _GET [''id'']);


但这也不起作用。我一直在运行类似构建的页面

在php< 5 ...现在我错过了什么,我正在转向PHP 5?


tia,


史蒂夫

解决方案

id =(isset(


_POST [''id''])?

_POST [''id'']:


i''ve setup a include page that''s responsible for building the basic layout
of my web pages (header, menus, etc.). each page includes this
"sysheader.php".

the first page i''ve built with this header is having odd results. its job is
to add users to the system. the variables i expect to be there are: id,
userName, password...stuff like that. after the require_once
"sysheader.php", i''ve put an "exit;" statement. the header shows perfectly.
if i try and access or set one of the expected variables, only part of the
header shows...crapping out around the time it is building the company
logo - so that i see "<img src="http://www" and nothing else.

i''ve tried to set my own variable order and initialze the variables myself
like this:

$id = (isset($_POST[''id'']) ? $_POST[''id''] : $_GET[''id'']);

but that doesn''t work either. i''ve been running similarly constructed pages
successfully under php < 5...what am i missing now that i''m moving to php 5?

tia,

steve

解决方案

id = (isset(


_POST[''id'']) ?


_POST[''id''] :


这篇关于php 5和未初始化的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆