随笔分类 -  symfony

摘要:控制器里生成地址 $this->generateUrl('course_manage_show_test', array('id' => 1)) twig前端文件生成地址: {{ path('course_manage_show_test',{id:1}) }} 阅读全文
posted @ 2021-02-19 15:39 study_php_java_C++ 阅读(80) 评论(0) 推荐(0) 编辑
摘要:先在配置文件 app/config/config.yml中配置 schema_filter: /^(?!(tablename))/ 即可,或者在出现问题表都加上一个id 然后再使用命令 php app/console doctrine:mapping:import LipinerAppapiBund 阅读全文
posted @ 2020-09-02 00:15 study_php_java_C++ 阅读(182) 评论(0) 推荐(0) 编辑
摘要:请求变量 // 全部变量 $request->query->all(); // 指定变量 $request->query->get('abc'); 请求方式 $request->getMethod(); 阅读全文
posted @ 2020-08-24 18:29 study_php_java_C++ 阅读(218) 评论(0) 推荐(0) 编辑
摘要:symfony中服务的使用总所周知的方便,但是当一个controller多次使用到同一个服务的时候就会出现在每个Action中都get获取服务,此时为了省事相信你也尝试使用构造函数申明一个私有对象避免多次使用,如果服务没问题此时使用 private $conn; private $sql; publ 阅读全文
posted @ 2020-08-24 18:02 study_php_java_C++ 阅读(191) 评论(0) 推荐(0) 编辑
摘要:https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/data-retrieval-and-manipulation.html#api $conn = $this->getDoctrine()->get 阅读全文
posted @ 2020-06-18 16:46 study_php_java_C++ 阅读(241) 评论(0) 推荐(0) 编辑
摘要:1. 数组,没有键名 但只查询出第一个结果 $conn = $this->getDoctrine()->getConnection(); $data = $conn->fetchArray('SELECT * FROM user where id < 3'); // 或者 // $data = $c 阅读全文
posted @ 2020-06-18 14:01 study_php_java_C++ 阅读(234) 评论(0) 推荐(0) 编辑
摘要:可以参考官方文档给出来的解决办法 http://symfonychina.com/doc/current/bundles/SensioGeneratorBundle/commands/generate_bundle.html 阅读全文
posted @ 2020-06-17 16:51 study_php_java_C++ 阅读(79) 评论(0) 推荐(0) 编辑
摘要:1. app/config/config_dev.yml framework: templating: engines: ['twig'] router: resource: "%kernel.root_dir%/config/dev/routing.yml" strict_requirements 阅读全文
posted @ 2020-03-27 09:59 study_php_java_C++ 阅读(377) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示