CakePhp: Avoid XSS attack keeping the ease of use of cake
问题 One of the things I like with cakePhp, is that we can easily have a generated edited form which allows us to save. E.g. in a controller: function add() { if (!empty($this->data)) { $this->Post->create(); if ($this->Post->save($this->data)) { $this->Session->setFlash(__('The post has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The post could not be saved. Please, try again.', true)); } } $users = $this->Post->User->find('list'); $this