小编Zhu*_*ukV的帖子

Symfony 2.1和Twig中导致"最大函数嵌套级别"错误的原因是什么?

我有一个关于Symfony 2.1的项目.更新作曲家组件(Gedemo,Symfony核心,Doctrine,Twig等)后,我有以下错误:

Fatal error: Maximum function nesting level of '100' reached, aborting! in /var/www/{path}/vendor/twig/twig/lib/Twig/Token.php on line 78
Run Code Online (Sandbox Code Playgroud)

我有PHP 5.4.什么可能导致此错误?

symfony twig

27
推荐指数
1
解决办法
3万
查看次数

iOS 8:UINavigationController隐藏后退按钮

在iOS 8(XCode 6.0.1,iPhone 6)中运行我的应用程序后,后退按钮不会隐藏.

我的代码:

- (void)removeCategoriesButton
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        [_navigationController.topViewController.navigationItem setHidesBackButton:YES];
        [_navigationController.topViewController.navigationItem setLeftBarButtonItem:nil];
    } else {
        UIViewController *controller = _app.window.rootViewController;

        if ([controller isKindOfClass:[UINavigationController class]]) {
            UINavigationController *nav = (UINavigationController *)controller;
            [nav.topViewController.navigationItem setHidesBackButton:YES];
            [nav.topViewController.navigationItem setLeftBarButtonItem:nil];
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但后退按钮不会隐藏(见截图):

模拟器屏幕

UPD:

我在另一个模拟器中运行应用程序,我只在iOS 8上看到这个"bug".

objective-c back-button ios ios8 iphone-6

18
推荐指数
4
解决办法
4万
查看次数

如何获取输入表单类型

我想获取表单字段类型并设置类fot字段类型

我尝试:

{# Form field row #}
{% block form_row %}
{% spaceless %}
  <div class="field-group{% if errors|length > 0%} error{%endif%}" id="fc-{{ id }}">
    {{ form_label(form, label|default(null)) }}
    <div class="field-item {{ type }}">
      {{ form_widget(form) }}
      {% if errors|length > 0 %}
        <div class="errors">{{ form_errors(form) }}</div>
      {% endif %}
    </div>
  </div>
{% endspaceless %}
{% endblock %}
Run Code Online (Sandbox Code Playgroud)

但{{type}}无效.

symfony twig

17
推荐指数
2
解决办法
1万
查看次数

从symfony 2.1(Doctrine)中的实体获取服务容器

如何在doctrine中使用实体作为服务(使用Symfony 2.1).

用法示例:

<?php

namespace MyNamespace;

class MyEntity
{
  protected $container = NULL;
  public function __construct($container)
  {
    $this->container = $container;
  }

  /** 
   * @ORM\PrePersist
   */
  public function() 
  {
    // Must call to container and get any parameters
    // for defaults sets entity parameters
    $this->container->get('service.name');
  }
}
Run Code Online (Sandbox Code Playgroud)

因此,我需要访问整个容器.

php service doctrine symfony

12
推荐指数
2
解决办法
3万
查看次数

iOS7和iOS8返回不同的UIScreen界限

我为部署目标> = 7.1创建应用程序.我看到了"bug"......应用程序只在横向模式下运行!

码:

CGSize frameSize = [[UIScreen mainScreen] bounds].size;
Run Code Online (Sandbox Code Playgroud)

在iOS 7(iPhone 4)中,返回CGSize (width=320, height=480),但必须返回480x320(因为在横向模式下运行应用程序).在iOS 8(iPhone 4S)中,返回CGSize (width=480, height=320)- 正确的结果.

iOS 7在没有检查横向/纵向模式的情况下返回帧的印象,以及纵向模式的返回尺寸.

谢谢.

iphone objective-c ios ios7 ios8

4
推荐指数
2
解决办法
1786
查看次数

Symfony 2中的路由缓存有多清楚

我在所有路径中覆盖了set requirements key {_locale}的路由加载器(routing.loader),并设置默认值.所有语言环境都保存在数据库中 我希望在数据库中保存新的语言环境后清除路由缓存(Matcher和Dumper缓存类),因为需要从DB加载需求参数.

谢谢.

routing symfony

2
推荐指数
1
解决办法
6571
查看次数

无法使用 curl 发送 HTTP/2 请求

我安装了支持 http2.0 协议的 curl,我在版本信息中看到了 HTTP2。

$ ./curl --version
curl 7.42.1 (x86_64-apple-darwin14.5.0) libcurl/7.42.1 OpenSSL/1.0.2a zlib/1.2.5 nghttp2/0.7.13
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets
Run Code Online (Sandbox Code Playgroud)

但是当我通过 curl(使用详细模式)发送请求时,我看到了 http1.1 协议。

./curl -v --http2 https://http2bin.org/get
*   Trying 104.131.161.90...
* Connected to http2bin.org (104.131.161.90) port 443 (#0)
* ALPN, offering h2-14
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set …
Run Code Online (Sandbox Code Playgroud)

curl openssl http2 osx-yosemite

1
推荐指数
1
解决办法
8708
查看次数