Home > PHP Framework > ThinkPHP > body text

Detailed explanation of Thinkphp5 integrated grid++ report

藏色散人
Release: 2021-02-20 17:30:34
forward
2695 people have browsed it

The tutorial column of thinkphp below will introduce to you how Thinkphp5 integrates grid reports. I hope it will be helpful to friends in need!

Detailed explanation of Thinkphp5 integrated grid++ report

## After checking many articles, there are very few articles on re-integration in thinkphp. Based on consulting online information and examples provided by grid, the process of integrating grid in thinkphp5 was completed.

Environment:
phpstudy, thinkphp5, grid Report6

1. Import files
<script type="text/javascript" src="__STATIC__/admin/js/GRInstall.js" ></script>
<script type="text/javascript" src="__STATIC__/admin/js/GRUtility.js" ></script>
<script type="text/javascript" src="__STATIC__/admin/js/CreateControl.js" ></script>
Copy after login
These three are the js used by the grid web plug-in , I put these three files in the public/admin/js directory, so... (Actually, just introduce the path wherever you put them) ######2. Make reports in the grid## ####Just follow the operating procedures######3. Insert the designer plug-in into the web page###
<script type="text/javascript"> 
    //用查询显示控件展现报表,从URL“../grf/1a.grf”获取报表模板定义,从URL“../data/DataCenter.php?data=Customer”获取XML形式的报表数据,
	CreateDisplayViewerEx("100%", "100%", "__STATIC__/grf/1a.grf", "__STATIC__/data/DataCenter.php?data=Student", true, "");
</script>
Copy after login
###3. Write the controller code###
public function DisplayViewReport() {

     return $this->fetch();
	}
Copy after login
###4. Modify the database connection code ######In the mysql_GenXmlData.php file in the Data directory, fill in the mysql_connect() according to your own database server conditions, and write your own database name in mysql_select_db(). ######### This is the simplest integration case, and multi-table queries are not involved. Start simple, and complex ones will become simple! #########

The above is the detailed content of Detailed explanation of Thinkphp5 integrated grid++ report. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!