rc / phpcr-fai-bundle
下载自动内联文件的文档
dev-master
2013-12-16 13:12 UTC
Requires
- php: >=5.3.2
- jackalope/jackalope-doctrine-dbal: dev-master
- lunetics/locale-bundle: dev-master
Requires (Dev)
- symfony/framework-bundle: >=2.1,<2.2-dev
This package is not auto-updated.
Last update: 2024-09-22 02:28:13 UTC
README
安装
步骤 1: 安装
php composer.phar install rc/phpcr-fai-bundle
步骤 2: 启用组件
在内核中启用组件
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new RC\PHPCR\FileAttachInlineBundle\RCPHPCRFileAttachInlineBundle(), ); }
步骤 3: 注册组件的路由
将以下内容添加到您的路由文件中
# app/config/routing.yml _rcfia: resource: . type: rcfia
配置
组件的默认配置如下所示
rcphpcr_file_attach_inline: web_root: %kernel.root_dir%/../web controller_action: rc_phpcr.controller:FindAction extensions: - pdf preference: - phpcr - filesystem max_filesize: 3072k mimetypes: - application/pdf - application/x-pdf providers: phpcr: locales: %locales% field: filePath multilang: true field_title: phpcr_locale:{_locale}-title
Apache 重写规则
运行
app/console rc:apache:dump
将结果粘贴到 web/.htaccess 中的第一个规则处
示例
# web/.htacess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(.*\.(pdf|zip|doc|txt|PDF|ZIP|DOC|TXT))$
RewriteRule .* app.php [QSA,L,E=_ROUTING__route:rcphpcr_file_attach_inline_homepage,E=_ROUTING_file:%1,E=_ROUTING_DEFAULTS__controller:RC\\PHPCR\\FileAttachInlineBundle\\Controller\\DefaultController\:\:FindAction]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>