sfDomainRoutePlugin을보세요. 원하는대로 작동합니다. 그러나 현재 버전에서는 Propel 또는 DoctrineRoute 기능을 사용하지 않으므로 플러그인에서 반환 된 하위 도메인 매개 변수를 기반으로 고객을 수동으로 조회해야합니다. 예 :
응용 프로그램/프론트 엔드/설정/routing.yml
# pick up the homepage
homepage:
url: /
class: sfDomainRoute
param: { module: homepage, action: index }
requirements:
sf_host: [www.example.com, example.com]
# catch subdomains for customers
customer_subdomain:
url: /
class: sfDomainRoute
param: { module: customer, action: index }
응용 프로그램/프론트 엔드/모듈/고객/actions.class.php
public function executeIndex(sfWebRequest $request)
{
// get the subdomain parameter
$this->subdomain = $request->getParameter('subdomain');
// retrieve customer (you have to create the retrieveBySubdomain method)
$this->customer = CustomerPeer::retrieveBySubdomain($this->subdomain);
}
이 그냥 예입니다,하지만 난 비슷한 접근법을 직접 사용하고, 플러그인은 광고되는 것을 수행합니다. 행운을 빕니다.
모험을 즐기는 사람이라면 "심포니와 함께하는 더 많은 책"에서 2 장을 살펴볼 수 있습니다. 이렇게하면 sfDomainRoutePlugin의 코드를 이해하는 데 도움이됩니다.
+1 좋은 질문 :-) – richsage
감사합니다! 다행히 누군가 대답을 알고 있습니다! :-) – Flukey