Get the App
SLTechnology News&Howtos  ›  Development  › 

What problems will be encountered in DWZ+ThinkPHP development?

Shulou Source: shulou.com Published: 2022-06-03 20:19:43 11月12日 Update

This article is to share with you about what problems you will encounter in DWZ+ThinkPHP development. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The details are as follows:

The thinkphp version I currently use is 3.1.3.

The J-UI dwz version seems to be 1.4.

When I encountered such a problem in the process of project development

When I perform the ajax operation in the background, success,error does not successfully return the prompt message, but returns an error message such as object object.

After studying for a long time, it is found that it is the problem of the version, and the newly revised ThinkPHP does not conform to the version of the Ajax technology in DWZ.

So I changed the ajaxReturn function in Action.class.php to

Protected function ajaxReturn ($data,$type='') {if (func_num_args () > 2) {/ / compatible prior to 3.0Use $args = func_get_args (); array_shift ($args); $info = array (); $info ['data'] = $data; $info [' info'] = array_shift ($args); $info ['status'] = array_shift ($args); $data = $info $type = $args?array_shift ($args):'';} / the addition to the original version-- $data ['statusCode'] = 1; / / $data [' navTabId'] = $_ REQUEST ['navTabId']; / / $data [' rel'] = $_ REQUEST ['rel']; / / $data [' callbackType'] = $_ REQUEST ['callbackType'] / / $data ['forwardUrl'] = $_ REQUEST [' forwardUrl']; / / $data ['confirmMsg'] = $_ REQUEST [' confirmMsg']; / / $data ['message'] = $data [' info']; / / 840206883@qq.com / / the addition to the original-/ / if (empty ($type)) $type = C ('DEFAULT_AJAX_RETURN') Exit (xml_encode ($data)); case 'JSONP': / / returns the JSON data format to the client containing status information header (' Content-Type:application/json; charset=utf-8'); $handler = isset ($_ get [C ('VAR_JSONP_HANDLER')])? $_ GET [C (' VAR_JSONP_HANDLER')]: C ('DEFAULT_JSONP_HANDLER') Exit ($handler.' ('.json _ encode ($data).'); case 'EVAL': / / returns the executable js script header (' Content-Type:text/html; charset=utf-8'); exit ($data); default: / / used to extend other returned format data tag ('ajax_return',$data);}} Thank you for reading!

Tags: Problem data format version development information content original customer client more status article part hint good practical successful function background Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Huawei Docker Microsoft