Home >Backend Development >PHP Tutorial >switch语句 - THINKPHP 多次include失效的问题

switch语句 - THINKPHP 多次include失效的问题

WBOY
WBOYOriginal
2016-06-06 20:28:541374browse

我的模版里面有volist循环,循环里面用switch来判断包含那个文件。类似如下:

<code><volist name="task_list" id="v">
            <switch name="v.task_code">
                <case value="0|11"><include file="Partner@Task/default"></include></case>
                <case value="2"><include file="Partner@Task/fabric"></include></case>
                <case value="3"><include file="Partner@Task/accessory"></include></case>
                <case value="4"><include file="Partner@Task/process"></include></case>
                <case value="8"><include file="Partner@Task/cost2"></include></case>
                <case value="9"><include file="Partner@Task/fabric_handle"></include></case>
                <case value="10"><include file="Partner@Task/garment"></include></case>
                <case value="12"><include file="Partner@Task/cut_pieces"></include></case>
                <case value="13"><include file="Partner@Task/shop_pro"></include></case>
                <case value="14"><include file="Partner@Task/up_pro"></include></case>
                <case value="15"><include file="Partner@Task/quality"></include></case>
                <default></default><include file="Partner@Task/default"></include>
            </switch>
          </volist></code>

现在有这样的问题, 包含文件多了之后,模版解析不了,直接显示空页面。
然后本地测试通过,测试环境也通过,生产环境不行。
测试环境的php版本:5.3.17,采用php-fpm
生产环境的PHP版本:5.3.3,没有用php-fpm

回复内容:

我的模版里面有volist循环,循环里面用switch来判断包含那个文件。类似如下:

<code><volist name="task_list" id="v">
            <switch name="v.task_code">
                <case value="0|11"><include file="Partner@Task/default"></include></case>
                <case value="2"><include file="Partner@Task/fabric"></include></case>
                <case value="3"><include file="Partner@Task/accessory"></include></case>
                <case value="4"><include file="Partner@Task/process"></include></case>
                <case value="8"><include file="Partner@Task/cost2"></include></case>
                <case value="9"><include file="Partner@Task/fabric_handle"></include></case>
                <case value="10"><include file="Partner@Task/garment"></include></case>
                <case value="12"><include file="Partner@Task/cut_pieces"></include></case>
                <case value="13"><include file="Partner@Task/shop_pro"></include></case>
                <case value="14"><include file="Partner@Task/up_pro"></include></case>
                <case value="15"><include file="Partner@Task/quality"></include></case>
                <default></default><include file="Partner@Task/default"></include>
            </switch>
          </volist></code>

现在有这样的问题, 包含文件多了之后,模版解析不了,直接显示空页面。
然后本地测试通过,测试环境也通过,生产环境不行。
测试环境的php版本:5.3.17,采用php-fpm
生产环境的PHP版本:5.3.3,没有用php-fpm

有必要这样?,不是有<php></php>吗,直接写原生啊,tp默认的标签嵌套是有限制的。

呃,我还真这样解决了问题。。蛋疼。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn