PHP出现Warning:Illegal offset type in
Warning
: Illegal offset type in
Warning
: Illegal offset type in isset or
empty in
前几天写程序的时候碰到一个这种错误提示
如果你使用这样的表示方法如下:
$arr = array();
class a
{
}
$o = new a;
echo $arr[$o];
就会出现上面的错误提示,因为不能使用实例化的对象来作为数组的索引,或者在使用isset empty检测这样的数据的时候也会出现第二种情况。
如果在做实际中碰到这样的错误提示,查看数组变量的键名是否使用了实例化的对象变量作为键名
相关文档:
php config
1.安装Apache2.2
2.安装php5.2(注意选择所有的库文件)
3.将phpMyAdmin解压,拷贝至Apache2.2\htdocs\phpmyadmin(该路径可以自由改变)下。
4.修改配置文件:
1)修改php.ini
具体操作:
extension_dir = "C:\Program Files\PHP\ext" (536)
extension=php ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</ ......
遍历目录文件,替换编码部分,删除原文件,再重新转码原文件内容,重新生成新文件。
function explorerdir($sDir){
static $aTempArr=array();
$dp=opendir($sDir);
while ($sFileName = readdir($dp)){
if ($sFileName !='.' && $sFileName !='..'){
......
<?php
//声明数组变量
$arr = array(val1 =>'张三',val2 => '李四',val3 => '王五',val4 => '李明',val5 => '周燕妮');
//foreach循环遍历数组
foreach($arr as $key => $value){
//注意“$value”后必须要一个空格,否则输 ......
<html>
<head>
<script type="text/javascript">
<!--
function confirmDelete()
{
return confirm("Are you sure you wish to delete this entry?");
}
//-->
</script>
</head>
<body>
<% $var1 = 2;%> ......