It is also possible to set the PHP globals through F3's COOKIE, GET, POST, REQUEST, SESSION, FILES, SERVER, ENV system variables. You can change them to modify a framework behaviour, for example: $f3 -> set ( 'CACHE', TRUE ) $f3 -> set ( 'HALT', FALSE ) $f3 -> set ( 'CASELESS', FALSE ) The framework has its own system variables. $f3 -> set ( 'm圜lass1', new m圜lass ( 'arg1' ), 3600 ) // change expire time for a single cookie var get() will load them automatically from the cache.Įxamples of caching framework variables: // cache string You can cache strings, arrays and all other types - even complete objects. If you need to cache vars for an infinite time, check the Cache->set method. Already cached vars will be updated by reusing the old expiration time. If the $ttl parameter is > 0, and the framework cache engine is enabled, the specified variable will be cached for $ttl seconds. Shorter ArrayAccess Syntax, since v3.4.0 $f3 -> LANGUAGE = 'en' $f3 -> foo = 1234 $f3 = 'buzzword' Caching properties Setting object properties: $f3 -> set ( 'a', new \ stdClass ) $f3 -> set ( 'a->hello', 'world' ) echo $f3 -> get ( 'a' ) -> hello // world Setting arrays: $f3 -> set ( 'hash', array ( 'x' => 1, 'y' => 2, 'z' => 3 ) ) // dot notation is also possible: $f3 -> set ( 'd', TRUE ) // d=TRUE, boolean $f3 -> set ( 'c', 'whatever' ) // c='whatever', string setīind value to hive key mixed set ( string $key, mixed $val )Įxamples of setting framework variables: $f3 -> set ( 'a', 123 ) // a=123, integer Storing a value in the hive ensures it is globaly available to all classes and methods in your application. The hive is a memory array to hold your framework variables in the form of key / value pairs. The file base.php also includes the essential Cache, Prefab, View, ISO and Registry classes to reduce unnecessary disk I/O for optimal performance.įeel free to remove all other files in the lib/ directory, if all you need are the basic features provided by this package. It contains everything you need to run a simple application. The Base class represents the framework core.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |