简体   繁体   English

访问PHP 5.2.17中的Iterator接口

[英]Accessing the Iterator interface in PHP 5.2.17

Currently we have to use PHP 5.2. 目前我们必须使用PHP 5.2。 Yes, I know I ought to upgrade to 5.3 or 5.4 but, in the meantime: 是的,我知道我应该升级到5.3或5.4,但在此期间:

I'm trying to write my own class that implements the Iterator interface. 我正在尝试编写自己的实现Iterator接口的类。 However, the class cannot be found, apparently because the Iterator interface is not loaded. 但是,无法找到该类,显然是因为未加载Iterator接口。 However, SPL is loaded which I thought was sufficient. 但是,SPL已加载,我认为已足够。

Any suggestions? 有什么建议么? Doubtless I've missed something stupid... 毫无疑问,我错过了一些愚蠢的事......

Thanks in advance. 提前致谢。

The iterator is not a class, it's an interface: 迭代器不是类,它是一个接口:

class Yourclass implements Iterator {

  // Methods here

}

If this didn't solve the issue, you should consider actually including some code in your question. 如果这不能解决问题,您应该考虑在您的问题中实际包含一些代码。

It looks like an old bug (not fixed) when using turkish locale : https://bugs.php.net/bug.php?id=18556 当使用土耳其语语言环境时,它看起来像一个旧的bug(未修复): https//bugs.php.net/bug.php? id = 18556

If so, try using another locale. 如果是这样,请尝试使用其他语言环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM