GithubHelp home page GithubHelp logo

mywork's People

Contributors

dreamant avatar

Stargazers

 avatar

Watchers

 avatar  avatar

mywork's Issues

不需要 {{v+1}} 这种语法

不需要

{{v+1}}

这种语法

模板保存简单

如果要做加运算可通过 helper 实现

{{add v 1}}
{
    "v":1
}

输出结果

2

需要一个模拟 AJAX 的测试函数

通过字符串定义 ajax 的两种返回值:

$_G['mockajax'](
        '/ajax/url/',
        '{"status":"success"}',
        '{"status":"error","msg":"详细错误消息"}'
    )

通过路径读取 json 文件,返回数据

$_G['mockajax'](
        '/ajax/login/',
        '/mock/login_success.json',
        '/mock/login_error.json'
    )

/mock/login_success.json 文件内容

{
    "status": "success"
}

访问页面 /ajax/url/ 时会返回 {"status":"success"}

获取 cookie 中的 NODEAJAX,它是一个JSON字符串。

解析它会变成

NODEAJAX = {
    ajax: {
        '/ajax/url/': {
            type: "error"
        }
    }
}

如果当前页(/ajax/url/)的 type 值是 error,则返回 {"status":"error","msg":"详细错误消息"}

关于 {php} echo 'test'; {/php}

{php} echo 'test'; {/php}

此语法不应该用于正式的生产环境,因为目前的主体**是前端书写和管理模板,如果里面掺杂 php代码,会导致前端无法复用模板。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.