Php strlen()要求参数1为字符串,数组给定

Php strlen()要求参数1为字符串,数组给定,php,arrays,strlen,Php,Arrays,Strlen,我有一个使用phorm的旧站点。提交表单时,我收到以下错误: 警告:strlen()希望参数1是字符串,数组在2015行的/home/user/public_html/form/phorm.php中给出 我知道这是因为升级到了PHP5.3,有没有一种简单的方法来修复这行代码,使我的表单再次工作 if (strlen($PHORM_ALERTTO) && !strlen($PHORM_TO) && !$PHORM_INFONLY && !$ph_G

我有一个使用phorm的旧站点。提交表单时,我收到以下错误:

警告:strlen()希望参数1是字符串,数组在2015行的/home/user/public_html/form/phorm.php中给出

我知道这是因为升级到了PHP5.3,有没有一种简单的方法来修复这行代码,使我的表单再次工作

 if (strlen($PHORM_ALERTTO) && !strlen($PHORM_TO) && !$PHORM_INFONLY && !$ph_GotData) {
    $PHORM_TO = $PHORM_ALERTTO; //THIS IS LINE 2015





 Read the mail template file(s) and mail it (them) to the user */
  $ph_section = "user template";
  if (strlen($PHORM_ALERTTO) && !strlen($PHORM_TO) && !$PHORM_INFONLY && !$ph_GotData) {
    $PHORM_TO = $PHORM_ALERTTO; //THIS IS LINE 2015
    settype($PHORM_TO, "array");
  }
  if (isset($PHORM_TMPL) && isset($PHORM_TO) && !$ph_Abort) {
    if ($ph_debug2) echo "<B>JS:</B> Mail Template(s)<BR>";

    if (count($PHORM_TMPL) > $ph_MaxTMPL) $ph_Alerts['120'] = ph_Message("A120");

    list(,$fPHORM_TO)      = each($PHORM_TO);
    list(,$fPHORM_SUBJECT) = each($PHORM_SUBJECT);

    while ($ph_MaxTMPL-- && list($ph_key, $lPHORM_TMPL) = each($PHORM_TMPL)) {
      if ($lPHORM_TMPL == ph_GENERIC) $lPHORM_TMPL = "$ph_root/files/generic.txt";
      else                            $lPHORM_TMPL = "$ph_tpd/$lPHORM_TMPL";

      $ph_Message   = "";
      $ph_Headers   = "";
      $ph_NonHeader = "";

      $lPHORM_TO      = "";
      $lPHORM_FROM    = "";
      $lPHORM_SUBJECT = "";
      $lPHORM_HEADERS = "";

      $ph_TemplateHeaders = false;
      if (ereg("(.+) +\+h$", $lPHORM_TMPL, $ph_regs)) {
        $lPHORM_TMPL = trim($ph_regs[1]);
        $ph_TemplateHeaders = true;
      }

      if ($ph_debug8) echo "Mail Template <B>$lPHORM_TMPL</B><BR>";

      if (!$ph_Template = @implode("", file($lPHORM_TMPL))) {
        $ph_Alerts['005'] = ph_Message("A005");
        if ($php_errormsg) $ph_Alerts['005P'] = "%%%: $php_errormsg";
        continue;
      }
if(strlen($PHORM_-alerto)和&!strlen($PHORM_-TO)和&!$PHORM_-INFONLY和&!$ph_-GotData){
$PHORM_TO=$PHORM_ALERTTO;//这是第2015行
阅读邮件模板文件并将其邮寄给用户*/
$ph_section=“用户模板”;
if(strlen($PHORM_-alerto)和&!strlen($PHORM_-TO)和&!$PHORM_-INFONLY和&!$ph_-GotData){
$PHORM_TO=$PHORM_ALERTTO;//这是第2015行
settype($PHORM_TO,“array”);
}
if(isset($PHORM_TMPL)和isset($PHORM_TO)和&!$ph_中止){
如果($ph_debug2)回显“JS:Mail模板”
; 如果(计数($PHORM_TMPL)>$ph_MaxTMPL)$ph_警报['120']=ph_消息(“A120”); 列表(,$fPHORM_-TO)=每个($PHORM_-TO); 列表($fPHORM_主题)=每个($fPHORM_主题); while($ph_MaxTMPL--&&list($ph_key,$lPHORM_TMPL)=每个($PHORM_TMPL)){ 如果($lPHORM_TMPL==ph_GENERIC)$lPHORM_TMPL=“$ph_root/files/GENERIC.txt”; else$lPHORM_TMPL=“$ph_tpd/$lPHORM_TMPL”; $ph_Message=“”; $ph_=”; $ph_NonHeader=“”; $lPHORM_TO=“”; $lPHORM_FROM=“”; $lPHORM_SUBJECT=“”; $lPHORM_HEADERS=“”; $ph_TemplateHeaders=false; 如果(ereg((.+)+\+h$,$lPHORM\U TMPL,$ph\U regs)){ $lPHORM_TMPL=trim($ph_regs[1]); $ph_TemplateHeaders=true; } 如果($ph_debug8)回显“邮件模板$lPHORM_TMPL
”; if(!$ph_Template=@inplade(“,file($lPHORM_TMPL))){ $PHU警报['005']=PHU消息(“A005”); 如果($php_errormsg)$ph_警报['005P']=“%%%:$php_errormsg”; 继续; }
这是因为您正在使用
strlen()
对数组进行计数,而当您需要对字符串进行计数时,应该使用数组。您的错误非常清楚


如果您需要计算一个或多个数组,只需使用或函数。

这是因为您正在使用
strlen()
对数组进行计数,而当您需要计算字符串时,它应该使用。您的错误非常清楚


如果您需要计算一个或多个数组,只需使用或函数。

这是因为,您只能使用它来计算字符串,如果您要计算一个数组,请使用
count()
所有内容都在警告中说明……有什么建议我需要在该行代码中更改什么吗?If(strlen($PHORM_ALERTTO)&!strlen($PHORM_to)&&!$PHORM_infoly&!$ph_GotData){$PHORM_TO=$PHORM_ALERTTO;//这是第2015行,这是因为,如果要计算数组,只能使用它来计算字符串,请使用
count()
警告中的所有内容……有什么建议我需要在该行代码中更改什么吗?if(strlen($PHORM_ALERTTO)&&!strlen($PHORM_TO)&&!$PHORM_INFONLY&!$ph_GotData){$PHORM_TO=$PHORM_ALERTTO;//这是第行2015@PeterEastwood错误意味着您对数组使用函数
strlen
,因此$PHORM_ALERTTO和/或$PHORM_to是数组,尝试更改为
if(count($PHORM_ALERTTO)&!count($PHORM_to)&&!$PHORM_INFONLY&&!$ph_GotData){$PHORM_TO=$PHORM_alerto;
@PeterEastwood错误意味着您将函数
strlen
用于数组,因此$PHORM_alerto和/或$PHORM_TO都是数组,如果(count($PHORM_alerto)和&!count($PHORM_TO)和&!$PHORM_INFONLY和!$ph_GotData){$PHORM_TO=$PHORM_alerto;