-4
我想創建後綴(名稱是我所做的)。 URL爆炸物低於..我怎樣才能從無盡循環中逃脫?
private function explode_url() {
if (!empty($this->suffix) and empty($is)) {
// look here ------V
$url = explode('/', rtrim($_GET['url'], $this->define_suffix()));
} else {
$url = explode('/', trim($_GET['url'], '/'));
}
$str = '';
foreach ($url as $key => $value) {
if ($key >= 2) {
$str = $str . '/' . $value;
} else {
$data[] = $value;
}
}
$data[] = trim($str, '/');
foreach ($data as $data) {
if (!empty($data)) {
$result[] = $data;
}
}
return $result;
}
這裏是定義後綴的功能。
private function define_suffix() {
$count = count($this->explode_url()); // <------ look here
$count = $count - 1;
$keys = array('cnt', 'mtd', 'args');
return $this->suffix[$keys[$count]];
}
實際上職能的工作不錯,但有一個問題。有一個無限循環。我怎麼能逃避這個?
編輯: 輸出:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 130968 bytes) in /var/www/cleanmvc/boot.php on line 85
的功能相互調用,這是造成無限循環。這是我需要幫助的。
看 「看這裏」 S!這不是我的問題的答案。 – user2544204
什麼?我清楚地回答了你的問題:「我怎麼能從無限循環中逃脫?」。也許你的問題沒有被正確地問,並且/或者提供的代碼是無效的。我向你提供了兩個答案,相當慷慨。 –
這些函數互相調用,導致無限循環。這是我需要幫助的。 – user2544204