Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么会出现此通知(12次):第90行app_vsf.php中的未初始化字符串偏移量:0_Php_Mysql - Fatal编程技术网

为什么会出现此通知(12次):第90行app_vsf.php中的未初始化字符串偏移量:0

为什么会出现此通知(12次):第90行app_vsf.php中的未初始化字符串偏移量:0,php,mysql,Php,Mysql,请帮助我解决标题中指定的问题 代码部分是: <?php // framework related things in this file. // vsf = Very Simple Framework $vsf = new stdClass; // default app_layout file $vsf->app_layout = 'app_layout.php'; // define the 'index' file, where we should link back

请帮助我解决标题中指定的问题

代码部分是:

<?php
// framework related things in this file.

// vsf = Very Simple Framework

$vsf = new stdClass;

// default app_layout file
$vsf->app_layout = 'app_layout.php';

// define the 'index' file, where we should link back to.
// Need to include the path, otherwise S.E. friendly URLS get messed up.
$vsf->self = '/mapcal/index.php';

// to support search engine friendly URLS, grab data from PATH_INFO
if (isset($_SERVER["PATH_INFO"]) ) {
$tmp_array = explode("/",$_SERVER["PATH_INFO"]);

for ($index = 0; $index < count($tmp_array); $index++) {
// only want the odd elements, they are the parameters.  The even ones are the values
if ( $index % 2 == 0 ) { continue; }
$_REQUEST[$tmp_array[$index]] = $tmp_array[$index+1];
}
}

// these functions are for form error handling
$errorfields = array();

$errormsgs = array();

$errorwasthrown = FALSE;

function adderrmsg($field = '', $msg = '') {
global $errorfields;
global $errormsgs;
global $errorwasthrown;

if ($field) {
$errorfields[] = $field;
}
if ($msg) {
$errormsgs[] = $msg;
}
$errorwasthrown = TRUE;
}

function displayformerrors($errhdr = 'The following errors occured:') {
global $errorfields;
global $errormsgs;

if ( empty($errorfields) and empty($errormsgs) ) {return;}

if (! empty($errormsgs) ) {
print "<p style='color: red;'>$errhdr<br>\n";

foreach ($errormsgs as $msg) {
  print "&#8226; $msg<br>\n";
  }
print "</p>\n\n";
}
}

function displayformlabel ($field = '', $label = '') {
global $errorfields;
if ( in_array($field,$errorfields) ) {
print "<span style='color: red;'>$label</span>";
}
else {
print $label;
}
}

function reuseform($formaction = 'new',$field_list = '',$query = '') {
if ($formaction == "new") {
foreach (split(",",$field_list) as $field) {
  global ${$field};
  ${$field} = '';
  }
}
elseif ($formaction == 'form') {
foreach (split(",",$field_list) as $field) {
  global ${$field};
  ${$field} = $_REQUEST[$field];
  }
}

elseif ($formaction == 'query') {
foreach (split(",",$field_list) as $field) {
  global ${$field};
  ${$field} = $query[$field];
  }
}

}  // close function reuseform

?>

检查以确保$\u请求包含变量


此外,默认情况下,reuseform似乎将$query设置为“”而不是数组()。。。是否正确设置了$query?此错误表明它不是。

显然
${$field}
的计算结果为
“0”
,并且
$query[“0”]
未定义。

您可以将此快速修复与
isset一起使用。

if(isset($GLOBALS[${$field}]))
{
    ${$field} = $query [$field];
}

在我短暂的编程生涯中,我从未见过使用
${$var_name}
。似乎我们缺少调用reuseform的地方。非常感谢你,Baba..注意问题消失了,但字段值没有显示,而是像以前一样保持空白。你能给我一个解决方案吗?把脚本放在你调用的
reuseform
form。。然后。。我会有更多关于如何最好地解决这个问题的信息。代码太长了,我无法将其嵌入到这里。我可以给你发电子邮件吗?