我正在尝试学习如何使用symfony,但是在通过composer更新后我得到了这个错误,我不明白如何解决它。
package com.rough;
public class ThreadsBehaviour {
static Object lock = new Object();
public static void main(String[] args) throws InterruptedException {
int a[] = {1,3,5,7,9};
int b[] = {2,4,6,8,10};
Thread odd = new Thread(new Looper(a, lock));
Thread even = new Thread(new Looper(b, lock));
odd.start();
even.start();
}
}
class Looper implements Runnable
{
int a[];
Object lock;
public Looper(int a[], Object lock)
{
this.a = a;
this.lock = lock;
}
@Override
public void run() {
for(int i = 0; i < a.length; i++)
{
synchronized(lock)
{
System.out.print(a[i]);
try
{
lock.notify();
if(i == (a.length - 1))
{
break;
}
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
PHP -v:
Twig_Error_Syntax in classes.php line 5280:
An exception has been thrown during the compilation of a template ("Catchable Fatal Error: Argument 1 passed to Twig_Filter::__construct() must be an instance of string, string given, called in C:\wamp64\www\symfony\var\cache\dev\classes.php on line 5573 and defined") in "@Twig/Exception/exception_full.html.twig".
如果有人可以告诉我该怎么做,我将不胜感激\ o /
谢谢!
我使用此cmd进行更新:
PHP 7.0.10 (cli) (built: Aug 18 2016 09:48:53) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
答案 0 :(得分:0)
遵循适用于Windows的安装说明: https://getcomposer.org/doc/00-intro.md#installation-windows
然后确保您可以直接从命令行(任何地方)运行命令composer
,而不是composer.phar。
在你的php ..composer.phar update
命令中,你上升到一个等级。但相反,如果&#34; C:\ wamp64 \ www \ symfony&#34;是您的Symfony项目位置,您应该输入:
C:\wamp64\www\symfony>composer update
一旦您完成了该操作,请告诉我们,看看是否能解决问题。
答案 1 :(得分:0)
新的twig版本和一些(wamp / xamp)服务器存在一些奇怪的问题。
您需要将composer.json中的twig版本更改为
"twig/twig": "~1.28"
并重新安装供应商(删除composer.lock,删除供应商目录和作曲家安装)