में सार नहीं होना चाहिए यह संदेश कुछ अजीब कारणों से php 5.4 में दिखाया गया है।सख्त मानकों: स्टेटिक फ़ंक्शन मॉडल :: tableStruct()
मेरी कक्षा इस तरह दिखता है:
class page extends model{
protected static function tableStruct(){
return array(
'id' => ...
'title' => ...
);
}
...
}
क्यों एक स्थिर विधि बच्चे कक्षाओं के लिए आवश्यक बनाने के मानकों के खिलाफ माना जाता है:
abstract class model{
private static
$tableStruct = array();
abstract protected static function tableStruct();
public static function foo(){
if(!isset(self::$tableStruct[get_called_class()]))
self::$tableStruct[get_called_class()] = static::tableStruct();
// I'm using it here!!
}
}
और की तरह इस्तेमाल किया जाना चाहिए?
यह केवल 5.4 नहीं है इसके कि थोड़ी देर के लिए की तरह किया गया। [समान प्रश्न] देखें (http://stackoverflow.com/questions/999066/why-does-php-5-2-disallow-abstract-static-class-methods)। –