创建类Tools \ MainBundle \ Controller \ Sm_Image_HandlerController
<?php
namespace Tools\MainBundle\Controller;
class Sm_Image_HandlerController{
public function test($param) {
return $param;
}
}
其他课程:
<?php
namespace FoodBundle\Controller;
use FoodBundle\Entity\FoodMaterialMapping;
use Symfony\Component\BrowserKit\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FoodBundle\Entity\Food;
use Symfony\Component\Validator\Constraints\NotBlank;
use Tools\MainBundle\Controller\Sm_Image_HandlerController;
/**
* Food controller.
*
*/
class FoodController extends Controller {
public function indexAction() {
$param="sample";
$sm=new Sm_Image_HandlerController();
$sample=$sm->test($param);
return new \Symfony\Component\HttpFoundation\Response(sample);
}
如果在类foodController中运行函数indexAction 返回错误
尝试从命名空间“Tools \ MainBundle \ Controller”加载类“Sm_Image_HandlerController”。 您是否忘记了另一个命名空间的“use”语句?
src / FoodBundle / Controller / FoodController.php第23行
<?php
public function createAction(Request $request) {
$param = "sample";
$sm = new Sm_Image_HandlerController();
$sample = $sm->test($param);
return new \Symfony\Component\HttpFoundation\Response(sample);
}
答案 0 :(得分:2)
您必须在symfony中为类和文件名使用CamelCase命名 重命名您的控制器及其文件
<style>
.video {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
transform: translateX(-50%) translateY(-50%);
-webkit-filter: blur(3px); //change the value according to what suits the best
-moz-filter: blur(3px); //change the value according to what suits the best
-o-filter: blur(3px); //change the value according to what suits the best
-ms-filter: blur(3px); //change the value according to what suits the best
filter: blur(3px); //change the value according to what suits the best
overflow: hidden;
}
.margin {
margin-top: 400px;
}
</style>
<video id="my-video" class="video" muted loop autoplay>
<source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"><!--
<source src="media/demo.ogv" type="video/ogg">
<source src="media/demo.webm" type="video/webm"> -->
</video>
<h1 class="margin"> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1><h1> Some Content</h1><h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1><h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>
<h1> Some Content</h1>