thinkphp uploadify图片上传后表单提交 这个流程应该怎么设计
如题
想要实现的就是 点击图片上传 上传多图 (已完成) 然后填写其他信息 表单提交 (已完成)
有两个表 表单信息表 和 附件表
疑问就是我用uploadyify上传直接插入到数据库里
有图片上传状态的字段 和 对应的是表单的ID 字段 来判断是哪个表单信息
下面是自己的处理的方式:
uploadify插入到数据库图片附件表 还要再次查询一下这个图片的ID 返回 (写入1次 查询1次)
多图的话 这应该返回ID数组吧 多图每个图片是一条记录 还是 写在一条记录里呢 记录附件地址的URL 这样会不会特别长呢
然后再填表单插入表单的表里 又再次查询返回表单填写记录的ID(写入1次 查询1次)
根据 返回的附件ID 找到表中记录位置 在吧 填写表单记录返回ID 填入 附件对应的表单ID字段里 同时图片的状态字段更改(查询一次 写入一次)
这样是不是非常不好的?
如果见个表单和附件的关系表 这种事最常用的么~
关系表里 表单ID 对应着 多张图片的ID 数组这样的?
请问这个是应该怎么设计的呢 正常来说~ 新手菜鸟 求大神指点~ 不知道都该怎么处理个流程额 求好心大神指点~
------解决思路----------------------
1、可以在表单里添加一个token作当前页面的标记,把本次上传的附件和表单内容关联起来
2、附件表可以单独维护,用token和表单数据做关联,可以对应多条记录,也可以一对一

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
