之后编辑我自己的评论
我认为问题在于,当PHP将文件解析为"compile"时,首先它会将类名转换为完全限定名.因此索引将被转换为Controller\Home\Index.之后,是PHP将变量转换为其值.因此,如果我使用变量作为类名,它将不会限定其名称,因为该步骤已经发生.这就是为什么找不到课程.这只是一个猜测,但最有可能就是 Blockquote
结束编辑
我使用Symfony2项目的UniversalClassLoader来自动加载我的类,但我发现了一些我无法解决的奇怪错误.
自动加载的东西工作正常,但后来我遇到了这个问题:
$controller = new Index(); // It works!
$controller_name = "Controller\\Home\\Index";
$controller2 = new $controller_name(); // It works!
$controller_name = "Index";
$controller3 = new $controller_name(); // Fatal error: Class 'Index' not found
Run Code Online (Sandbox Code Playgroud)
这2个案例工作得很好.在第一个,因为我使用"使用Controller\Home;" 在我的脚本开头,我可以只使用"new Index();" 没有问题.但如果不是写"索引",而是使用像$ var ="Index"这样的字符串变量,它就不起作用了.我不明白为什么.我需要这个脚本是动态的,这就是为什么我需要一个变量.
谢谢!
额外的长尾搜索:
在Counter和之间做出决定时Gauge,Prometheus 文档指出
在计数器和仪表之间进行选择,有一个简单的经验法则:如果值可以下降,它就是一个仪表。计数器只能上升(并重置,例如当进程重新启动时)。
它们似乎涵盖了重叠的用例:您可以使用只会增加的仪表。那么为什么要首先创建 Counter 指标类型呢?为什么不简单地将 Gauges 用于两者?
我想创建我的自定义SonarQube docker镜像,已安装了一些插件,但每次运行我的容器时,插件都不存在.这就像有些东西从那里删除插件/opt/sonarqube/extensions/plugins并复制bundled-plugins那里.
我的Dockerfile
FROM sonarqube
ENV SONARQUBE_HOME /opt/sonarqube
RUN wget "http://downloads.sonarsource.com/plugins/org/codehaus/sonar-plugins/sonar-scm-git-plugin/1.1/sonar-scm-git-plugin-1.1.jar" \
&& wget "https://github.com/SonarSource/sonar-java/releases/download/3.12-RC2/sonar-java-plugin-3.12-build4634.jar" \
&& wget "https://github.com/SonarSource/sonar-github/releases/download/1.1-M9/sonar-github-plugin-1.1-SNAPSHOT.jar" \
&& wget "https://github.com/SonarSource/sonar-auth-github/releases/download/1.0-RC1/sonar-auth-github-plugin-1.0-SNAPSHOT.jar" \
&& wget "https://github.com/QualInsight/qualinsight-plugins-sonarqube-badges/releases/download/qualinsight-plugins-sonarqube-badges-1.2.1/qualinsight-sonarqube-badges-1.2.1.jar" \
&& mv *.jar $SONARQUBE_HOME/extensions/plugins \
&& ls -lah $SONARQUBE_HOME/extensions/plugins
Run Code Online (Sandbox Code Playgroud)
我尝试列出该文件夹,它列出了我想要的插件.但是,如果我在启动容器后列出相同的文件夹,它们就会消失.
我也试过删除bundled-plugins没有运气.
有任何想法吗?
学习骨干我创建一个像app的Twitter.所以你知道Twitter每N秒向服务器发送一个GET请求来检查新的推文.如果有新的推文,它会创建隐藏的li元素,并显示带有"N个新推文"的按钮.如果单击它,它会显示隐藏的li元素,显示新的推文.但是当您添加新推文时,行为会有所不同:推文是可见的.您无需单击按钮即可查看.
对于隐藏的推文,我已经做了第一部分.对于发布新推文并显示直接的部分,我认为通过创建新模型,调用collection.create()并触发正确的事件会很容易,例如:
var newTweet = new Tweet();
newTweet.set( /* set the attributes here. Some attributes are missing, because they are calculated server side */ );
var created_tweet = this.collection.create( newTweet, { silent: true, wait: true } ); // I choose silent=true because the add event on my collection is in charge of adding the new hidden tweets when there are new ones on the server
this.collection.trigger("posted_new_tweet", created_tweet);
Run Code Online (Sandbox Code Playgroud)
然后,我的集合订阅了事件"posted_new_tweet",因此每次用户发布新的推文时,都会调用我的集合的特定方法.这种方法工作正常,直到我因触发器中传递的变量created_comment而出现错误:它不是"完整".我的意思是模型有一些属性,如"id"或*"created_on"*未定义.这些属性是在服务器端计算的,但我认为如果我通过wait = true,它将等待并使用服务器给出的响应更新我的模型(当向服务器发出POST请求时,它将返回新创建的模型JSON) …
autoload ×1
backbone.js ×1
docker ×1
javascript ×1
metrics ×1
monitoring ×1
namespaces ×1
php ×1
prometheus ×1
sonarqube ×1
symfony ×1