Php framework-how to generate the U function in thinkphp?

Source: Internet
Author: User
{Code...} This is in js Code. This id is a js variable. How can I generate a url? What should I do in this case? What does the U method seem to be powerless ??? Online Expert solutions? Is the U method powerless in this case of JS !!!
var id = 123;XHR.open('get','{:U("shop/goods/type_del", array("id" => id))}',false);

This is in the js Code. This id is a js variable. How can I generate a url?

What should I do in this case? What does the U method seem to be powerless ???

Online Expert solutions?

Is the U method powerless in this case of JS !!!

Reply content:
var id = 123;XHR.open('get','{:U("shop/goods/type_del", array("id" => id))}',false);

This is in the js Code. This id is a js variable. How can I generate a url?

What should I do in this case? What does the U method seem to be powerless ???

Online Expert solutions?

Is the U method powerless in this case of JS !!!

{: U ("shop/goods/type_del ")? Id =} id

This can only be pieced together by myself, or it looks uncomfortable. I can use js to write a function similar to the U method. I remember that thinksns used to write a U method... but it is still not flexible.

var id = 123;XHR.open('get','{:U("shop/goods/type_del")}?id='+id,false);

This can only be pieced together by yourself. When the template engine is compiled, no value is assigned to the id.

U("shop/goods/type_del")+'?id='+id

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.