这是一个使用Symfony开发的网站,托管在Linux VPS上。这仅在站点执行重定向时发生,有时它不会呈现代码并在页面顶部添加0。我附上了显示内容的屏幕截图。我们尝试在云服务器上安装该站点,但不会发生此问题。
其中一个页面是登录页面。如果您使用的是Windows计算机,则可以尝试使用用户名 testuser 和密码 testuser 进行登录,并且由于页面上的重定向,有时会生成错误。
以下代码是控制器中用于创建新职位描述(http://hr-tool.inshpo.org/description/new)的操作。表单成功提交后,会重定向到另一个页面。
/**
* Creates a new Description entity.
*
* @Route("/new", name="description_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
$description = new Description();
$description->setCountry($this->getUser()->getCountry());
$description->setUser($this->getUser());
$form = $this->createForm('PositionBundle\Form\DescriptionType', $description);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$description->setPickedType($description->getMainPosition()->getType());
$em = $this->getDoctrine()->getManager();
$em->persist($description);
$em->flush();
$points = $em->getRepository('PositionBundle:Point')->findAll();
$positions = $em->getRepository('PositionBundle:Position')->findBy(['level'=>$description->getMainPosition()->getLevel(),'type'=>$description->getPickedType()],['point'=>'ASC']);
for ($i = 0 ; $i< count($points); $i++){
$customPoint = new CustomPoint();
$customPoint->setPoint($points[$i]);
$customPoint->setDescription($description);
$customPoint->setPickedPosition($positions[$i]);
$em->persist($customPoint);
}
$customDuty = new CustomDuty();
$activities = $em->getRepository('PositionBundle:Activity')->findAll();
$customDuty->setDutyDescription($this->get('libs.entities_crawlers')->getDutiesTextarea($activities,$description->getPickedType()));
$customDuty->setDescription($description);
$em->persist($customDuty);
$em->flush();
return $this->redirectToRoute('description_my_tabs', array('id' => $description->getId()));
}
return $this->render('description/new.html.twig', array(
'description' => $description,
'form' => $form->createView(),
));
}