问题:
如您所见,在列路径下,每个路径前都有一个标签<href=>
。我不知道为什么会在那里。在Symfony 3.4和FOSRest中,它没有显示。
/**
* @Rest\Route(value="users")
*/
class UserController extends AbstractFOSRestController {
/**
* Add new user
*
* @Rest\Post(path="/user/register", name="users_user_register")
*
* @RequestParam(name="name", nullable=false, allowBlank=false)
* @RequestParam(name="surname", nullable=false, allowBlank=false)
* @RequestParam(name="email", nullable=false, allowBlank=false)
* @RequestParam(name="password", nullable=false, allowBlank=false)
* @RequestParam(name="language", nullable=false, allowBlank=false)
*/
public function register() {
return $this->view(['info' => 'test'], 201);
}
}
我的framework.yml:
framework:
secret: '%env(APP_SECRET)%'
session:
enabled: false
php_errors:
log: true
我的routing.yml:
framework:
router:
strict_requirements: true
utf8: true
http_method_override: true
我的fos_rest.yml:
fos_rest:
param_fetcher_listener: true
allowed_methods_listener: true
access_denied_listener:
xml: true
body_converter:
enabled: true
routing_loader:
default_format: json
include_format: false
view:
formats:
json: true
html: true
view_response_listener: force
exception:
enabled: true
exception_controller: 'App\Controller\ExceptionController::handle'
format_listener:
enabled: true
rules:
- { path: ^/api, prefer_extension: false, fallback_format: json, priorities: [json] }
- { path: ^/api/v1/doc, priorities: ['html'], fallback_format: html }