0
在下面的If .. else语句中,我想看看是否第一,有一个第四个面包屑(URI数组4),然后看看它是否是一个数字..PHP其他语句不工作,因为它应该.. is_numeric和isset
但双方始终返回true,数字,字母或空..
谁能告诉我为什么?
// checks the third breadcrumb contained within the breadcrumbs class to see
// if it is an article. Then uses a recursive function to search the first
// and second breadcrumbs to see if they exist within their respective menu
// arrays. finally, if that validates, then the fourth breadcrumb is checked
// to see if it exists (not empty) AND if it is a number.
else
if (($this->breadcrumbs->getCrumb(3)=='article' &&
$array_helper->recValueReturn($this->breadcrumbs->getCrumb(2),
$this->getNavTwo()) &&
$array_helper->recValueReturn($this->breadcrumbs->getCrumb(1),
$this->getNavOne())) || ($this->breadcrumbs->getCrumb(4)) &&
is_numeric($this->breadcrumbs->getCrumb(4))) {
...
总是以下验证为False:
else
if (($this->breadcrumbs->getCrumb(3)=='article'&&
$array_helper->recValueReturn($this->breadcrumbs->getCrumb(2),
$this->getNavTwo()) &&
$array_helper->recValueReturn($this->breadcrumbs->getCrumb(1),
$this->getNavOne())) &&
(array_key_exists($this->breadcrumbs->getCrumb(4),
$this->breadcrumbs->getCrumbs())&&
is_numeric($this->breadcrumbs->getCrumb(4)))) {
...
'$ this-> breadcrumbs-> getCrumb(3)'是什么格式和数据? – Raptor
你有没有尝试输出你正在检查的各种值? – Jim
您是否尝试过使用具有描述性名称的函数对其进行重构,以便任何人都能知道发生了什么,而不会盯着它几分钟? –