CakePHP Cookbook 3.x
prefer using Body Parser Middleware instead of RequestHandlerComponent. Checking Content-Type Preferences RequestHandlerComponent::prefers($type = null) Determines which content-types the client prefers $schema->setColumnType('preferences', 'json'); // Prior to 3.6 you should use ``columnType`` instead of ``setcolumnType``. $schema->columnType('preferences', 'json'); return return $schema; } } The code above maps the preferences column to the json custom type. This means that when retrieving data for that column, it will be unserialized from a JSON string in the database and0 码力 | 1244 页 | 1.05 MB | 1 年前3
CakePHP Cookbook 4.x
Content Type Negotiation Fallbacks If no View can be matched with the request’s content type preferences, CakePHP will use the base View class. If you want to require content-type negotiation, you can RequestHandlerComponent in 4.0. You should use Body Parser Middleware instead. Checking Content-Type Preferences RequestHandlerComponent::prefers($type = null) Determines which content-types the client prefers = parent::getSchema(); $schema->setColumnType('preferences', 'json'); return $schema; } } The code above maps the preferences column to the json custom type. This means that when retrieving0 码力 | 1249 页 | 1.04 MB | 1 年前3
CakePHP Cookbook 3.x
prefer using body-parser-middleware instead of RequestHandlerComponent. Checking Content-Type Preferences RequestHandlerComponent::prefers($type = null) Determines which content-types the client prefers $schema) { $schema->setColumnType('preferences', 'json'); // Prior to 3.6 you should use ``columnType`` instead of ``setcolumnType``. $schema->columnType('preferences', 'json'); return $schema; } } The The code above maps the preferences column to the json custom type. This means that when retrieving data for that column, it will be unserialized from a JSON string in the database and put into an entity0 码力 | 967 页 | 2.80 MB | 1 年前3
CakePHP Cookbook 4.x
Content Type Negotiation Fallbacks If no View can be matched with the request’s content type preferences, CakePHP will use the base View class. If you want to require content-type negotiation, you can RequestHandlerComponent in 4.0. You should use body-parser-middleware instead. Checking Content-Type Preferences RequestHandlerComponent::prefers($type = null) Determines which content-types the client prefers TableSchemaInterface { $schema = parent::getSchema(); $schema->setColumnType('preferences', 'json'); return $schema; } } The code above maps the preferences column to the json custom type. This means that when retrieving0 码力 | 967 页 | 2.88 MB | 1 年前3
CakePHP Cookbook Documentation 5.xContent Type Negotiation Fallbacks If no View can be matched with the request’s content type preferences, CakePHP will use the base View class. If you want to require content-type negotiation, you can = parent::getSchema(); $schema->setColumnType('preferences', 'json'); return $schema; } } The code above maps the preferences column to the json custom type. This means that when retrieving saved, the array will be transformed back into its JSON representation: $user = new User([ 'preferences' => [ 'sports' => ['football', 'baseball'], 'books' => ['Mastering PHP', 'Hamlet']0 码力 | 1080 页 | 939.39 KB | 1 年前3
CakePHP Cookbook Documentation 5.xContent Type Negotiation Fallbacks If no View can be matched with the request’s content type preferences, CakePHP will use the base View class. If you want to require content-type negotiation, you can TableSchemaInterface { $schema = parent::getSchema(); $schema->setColumnType('preferences', 'json'); return $schema; } } The code above maps the preferences column to the json custom type. This means that when retrieving saved, the array will be transformed back into its JSON representation: $user = new User([ 'preferences' => [ (continues on next page) More Information 455 CakePHP Cookbook Documentation, Release0 码力 | 848 页 | 2.53 MB | 1 年前3
CakePHP Cookbook 2.x
for the domain ‘example.com’ which needs a secure connection, is available on the path ‘/bakers/preferences/’, expires in one hour and is HTTP only: public $components = array('Cookie'); public function = 'baker_id'; $this->Cookie->time = 3600; // or '1 hour' $this->Cookie->path = '/bakers/preferences/'; $this->Cookie->domain = 'example.com'; $this->Cookie->secure = true; // i.e. only sent i18n Now you can use locale definition files for the LC_TIME category to retrieve date and time preferences for a specific language. Just use any POSIX compliant locale definition file and store it at app/locale/language/0 码力 | 1096 页 | 958.62 KB | 1 年前3
CakePHP Cookbook 2.x
for the domain ‘example.com’ which needs a secure connection, is available on the path ‘/bakers/preferences/’, expires in one hour and is HTTP only: 392 Chapter 7. Core Libraries CakePHP Cookbook Documentation $this->Cookie->name = 'baker_id'; $this->Cookie->time = 3600; // or '1 hour' $this->Cookie->path = '/bakers/preferences/'; $this->Cookie->domain = 'example.com'; $this->Cookie->secure = true; // i.e. only sent if using i18n Now you can use locale definition files for the LC_TIME category to retrieve date and time preferences for a specific language. Just use any POSIX compliant locale definition file and store it at app/locale/language/0 码力 | 820 页 | 2.52 MB | 1 年前3
共 8 条
- 1













