Navigation

    Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

    开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

    如果您登录系统碰到问题,请在微信公众号留言:

    Web开发中怎么处理多参数

    Odoo 开发与实施交流
    4
    7
    4155
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      baialaps last edited by

      请教一下, 在web开发中,只带一个参数的时候官方文档中是这样写:

      <br />@http.route(&#039;/say_hello&#039;, type=&quot;http&quot;) <br />	def say_hello(self, name): <br />		return &quot;&lt;h1&gt;Hello %s&lt;/h1&gt;&quot; % name <br />
      


      这样可以在say_hello?name=myname
      直接打印出参数来。

      但是如果我要传入多个参数的时候,要怎么写呢?

      希望得到各位的帮助! 谢谢

      1 Reply Last reply Reply Quote 0
      • Joshua
        Joshua 管理员 last edited by

         [检测到链接无效,已移除] =value1
        
        1 Reply Last reply Reply Quote 0
        • mrshelly
          mrshelly last edited by

          <br /><br />...<br /><br />def say_hello(self, name, *arg1, **arg2):<br /><br />...<br />
          
          1 Reply Last reply Reply Quote 0
          • B
            baialaps last edited by

            谢谢总监

            1 Reply Last reply Reply Quote 0
            • Joshua
              Joshua 管理员 last edited by

              第一次没写全,shelly已经补充了下,另外一种就是通过post的方式,直接

              <br />&nbsp; &nbsp; @http.route(&#039;/say_hello&#039;, type=&quot;http&quot;) <br />&nbsp; &nbsp; def say_hello(self, **post): <br />&nbsp; &nbsp; &nbsp; &nbsp; name = post&#91;&#039;name&#039;]<br />&nbsp; &nbsp; &nbsp; &nbsp; age = post&#91;&#039;age&#039;]<br />
              
              1 Reply Last reply Reply Quote 0
              • 佳先生
                佳先生 last edited by

                [quote author=Joshua link=topic=16258.msg27561#msg27561 date=1393983744]
                第一次没写全,shelly已经补充了下,另外一种就是通过post的方式,直接

                <br />&nbsp; &nbsp; @http.route(&#039;/say_hello&#039;, type=&quot;http&quot;) <br />&nbsp; &nbsp; def say_hello(self, **post): <br />&nbsp; &nbsp; &nbsp; &nbsp; name = post&#91;&#039;name&#039;]<br />&nbsp; &nbsp; &nbsp; &nbsp; age = post&#91;&#039;age&#039;]<br />
                


                [/quote]

                请问怎么在外部调用/say_hello,相当于一个接口??

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post