我试图在服务容器中包含Symfony2(2.1.4-DEV)中类TCPDF的扩展.为此我编辑symfony/app/config/config.yml了:
services:
extend_pdf:
class: Acme\VSBundle\extend_pdf
Run Code Online (Sandbox Code Playgroud)
在文件中symfony/src/Acme/VSBundle/extend_pdf.php我有一个虚拟类,如:
<?php
namespace Acme\VSBundle;
// extend TCPF with custom functions
class extend_pdf extends TCPDF {
}
?>
Run Code Online (Sandbox Code Playgroud)
我在控制器中加载如:
function testAction() {
$extendpdf = $this->get('extend_pdf');
return new Response('success');
}
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误的错误:
致命错误:第417行/home/user/public_html/Acme/Symfony/app/cache/dev/appDevDebugProjectContainer.php中找不到类'Acme\VSBundle\extend_pdf'调用堆栈:...
缓存是空的,我不知道,为什么它找不到我的课.
谢谢
我有一个非常简单的代码,但它仍然无法按我想要的方式工作.它应该让我回到它所经历的所有n,但我只得到最后一个:"10000001".我错了什么?
#include <iostream>
using namespace std;
int main()
{
int n=1000;
int i=1;
for(;i<3;n*=100,i++);
{
cout << ++n << "\n";
int* temp = new int[n];
delete [] temp;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)