在将其发送到浏览器之前,我尝试了以下方法来编辑drupal 8中的内容。
这是到目前为止,我没有得到任何HTML
public function onKernelResponse(FilterResponseEvent $event) : void
{
$request = $this->container->get('request_stack')->getCurrentRequest();
$response = $event->getResponse();
// Replacement for link headers for domains for Chinese vs. Other Languages.
$headers = $response->headers;
$links = $headers->get('link','',false);
$links = str_replace($this->domain_patterns, $this->domain_replacements, $links);
$headers->remove('link');
$headers->set('link',$links, false);
// Replacement for h2->h1 when neccesary and domains for Chinese vs. other languages in content.
$html = $response->getContent();
我在$ html中没有得到任何提示