当前位置:网站首页>Thinkphp5 how to determine whether a table exists
Thinkphp5 how to determine whether a table exists
2022-07-02 09:26:00 【Yisu cloud】
thinkphp5 How to judge whether a table exists
This article mainly shows you “thinkphp5 How to judge whether a table exists ”, The content is simple and easy to understand , Clarity of organization , I hope I can help you solve your doubts , Now let Xiaobian lead you to study and learn “thinkphp5 How to judge whether a table exists ” This is the article .
Method :1、 use “$a=M()->query('SHOW TABLES LIKE" Table name "');if($a){ There is }else{ Table does not exist }” Judge ;2、 use “$a=M( Table name );if($a->getDbError()){ Table does not exist }else{ There is }” Judge .
This article describes the operating environment :Windows10 System 、ThinkPHP5 edition 、Dell G3 The computer .
thinkphp5 How to judge whether a table exists
thinkphp Framework is a very easy-to-use and powerful framework , It is the development habit of our people . So in use thinkphp Frame time , Sometimes there's a need , It is necessary to judge whether a database table exists .
ad locum , We assume judgment users Does the table exist :
$users = M('users');
if($users->getDbError()){
echo ' Data table does not exist !';
}else{
echo ' The database exists !';
}Method 2:
$isTable = M()->query('SHOW TABLES LIKE "table_name"');
if( $isTable ){
echo ' Table exists ';
}else{
echo ' Table does not exist ';
}Above is “thinkphp5 How to judge whether a table exists ” All the content of this article , Thank you for reading ! I believe we all have a certain understanding , I hope the content shared will be helpful to you , If you want to learn more , Welcome to the Yisu cloud industry information channel !
边栏推荐
- Insight into cloud native | microservices and microservice architecture
- Chrome视频下载插件–Video Downloader for Chrome
- 队列管理器running状态下无法查看通道
- [staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)
- Jd.com interviewer asked: what is the difference between using on or where in the left join association table and conditions
- Chrome browser plug-in fatkun installation and introduction
- Solutions to Chinese garbled code in CMD window
- Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method
- Pool de connexion redis personnalisé
- Pdf document of distributed service architecture: principle + Design + practice, (collect and see again)
猜你喜欢
![[staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)](/img/ae/1ecb352c51a101f237f244da5a2ef7.jpg)
[staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)

Chrome浏览器插件-Fatkun安装和介绍

Watermelon book -- Chapter 6 Support vector machine (SVM)

Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)

Break the cocoon | one article explains what is the real cloud primordial

Micro service practice | introduction and practice of zuul, a micro service gateway

Jd.com interviewer asked: what is the difference between using on or where in the left join association table and conditions

数构(C语言)——第四章、矩阵的压缩存储(下)

自定義Redis連接池

概念到方法,绝了《统计学习方法》——第三章、k近邻法
随机推荐
Micro service practice | introduction and practice of zuul, a micro service gateway
Jingdong senior engineer has developed for ten years and compiled "core technology of 100 million traffic website architecture"
[staff] the lines and spaces of the staff (the nth line and the nth space in the staff | the plus N line and the plus N space on the staff | the plus N line and the plus N space below the staff | the
Number structure (C language -- code with comments) -- Chapter 2, linear table (updated version)
Mathematics in machine learning -- point estimation (I): basic knowledge
"Interview high frequency question" is 1.5/5 difficult, and the classic "prefix and + dichotomy" application question
JVM指令助记符
微服务实战|手把手教你开发负载均衡组件
Microservice practice | fuse hytrix initial experience
使用IBM MQ远程连接时报错AMQ 4043解决思路
西瓜书--第六章.支持向量机(SVM)
Dix ans d'expérience dans le développement de programmeurs vous disent quelles compétences de base vous manquez encore?
C4D quick start tutorial - C4d mapping
Microservice practice | declarative service invocation openfeign practice
微服务实战|熔断器Hystrix初体验
Programmers with ten years of development experience tell you, what core competitiveness do you lack?
Machine learning practice: is Mermaid a love movie or an action movie? KNN announces the answer
VIM operation command Encyclopedia
微服务实战|微服务网关Zuul入门与实战
MySQL error: unblock with mysqladmin flush hosts