PHP引用有关问题

WBOY
Release: 2016-06-13 10:33:43
Original
861 people have browsed it

PHP引用问题
我在A文件中引用B文件的函数cut(),在A页面中写include_once("B.php");然后在下面调用但不知道为什么老是运行报错Fatal error: Call to undefined function cut() in D:\XAMPP1.7.3\xampp\htdocs\web\index.php on line 233
这个是不是说没有定义CUT函数?但我明明定义了啊。然后查看A页面源文件的时候,本该显示结果的那段显示的却是我的CUT函数代码。
CUT函数是
function cut($Str, $Length) {//$Str为截取字符串,$Length为需要截取的长度 

global $s;
$i = 0;
$l = 0;
$ll = strlen($Str);
$s = $Str;
$f = true; 

while ($i if (ord($Str{$i}) $l++; $i++;
} else if (ord($Str{$i}) $l++; $i += 2;
} else if (ord($Str{$i}) $l += 2; $i += 3;
} else if (ord($Str{$i}) $l += 1; $i += 4;
} else if (ord($Str{$i}) $l += 1; $i += 5;
} else if (ord($Str{$i}) $l += 1; $i += 6;


if (($l >= $Length - 1) && $f) {
$s = substr($Str, 0, $i);
$f = false;


if (($l > $Length) && ($i $s = $s . '...'; break; //如果进行了截取,字符串末尾加省略符号“...”
}
}
return $s;
}
?>

不知道我表达的清楚不,希望有人能帮忙解答。

------解决方案--------------------
你开启了php断标签了吗,你A文件的php标签应该是------解决方案--------------------

探讨

你开启了php断标签了吗,你A文件的php标签应该是
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!