多属性搜索
http://detail.zol.com.cn/notebook_index/subcate16_0_list_4000_s1227_1_1_0_1.html 中关村在线http://price.pcauto.com.cn/price/q-p2-k75.html 太平洋汽车
点击某项属性,没有产品的某些属性就会相应的变灰不可用状态,
感问 要实现这样的功能是怎样的思路,如何做。。。
分数不多见谅了,呵呵....
回复讨论(解决方案)
这个之前有人问过
两种方案:
1是用javascript根据选择的变量组合成一个url,这种方案需要先选择,点击一个按钮后打开网页(操作有点像提交)
2是php根据每种参数写一个链接,这种方案每点击一个参数就刷新网页,刷新网页时就把参照已经选择的多个条件把所有链接重新计算输出
2的变形方案是ajax
view-source:http://detail.zol.com.cn/notebook_index/subcate16_0_list_4000_s1227_1_1_0_1.html
<dt>品牌</dt> <dd class="brand-sel-box clearfix"> <div id="singular" class="brand-list"> <span class="all sel">不限</span> <a href="/notebook_index/subcate16_160_list_4000_s1227_1_1_0_1.html">联想</a> <a href="/notebook_index/subcate16_227_list_4000_s1227_1_1_0_1.html">华硕</a> <a class="null" rel="nofollow" href="/notebook_index/subcate16_21_list_4000_s1227_1_1_0_1.html">戴尔</a> <a class="null" rel="nofollow" href="/notebook_index/subcate16_223_list_4000_s1227_1_1_0_1.html">惠普</a> <a href="/notebook_index/subcate16_1191_list_4000_s1227_1_1_0_1.html">神舟</a> <a class="null" rel="nofollow" href="/notebook_index/subcate16_218_list_4000_s1227_1_1_0_1.html">Acer宏?</a>.....<dt>价格</dt> <dd class="clearfix"> <a href="/notebook_index/subcate16_list_s1227_1.html" class="all">不限</a> <a class="null" rel="nofollow" href="/notebook_index/subcate16_0_list_0_s1227_1_1_0_1.html">1999元以下</a> <a href="/notebook_index/subcate16_0_list_2000_s1227_1_1_0_1.html">2000-2499元</a> <a href="/notebook_index/subcate16_0_list_2500_s1227_1_1_0_1.html">2500-2999元</a>很明显,连接是由服务端产生的
view-source:http://price.pcauto.com.cn/price/q-p2-k75.html
<div class="getTh">价格:</div><div class="umLimit"><a class='' href="/price/q-k75.html">不限</a></div><div class="Items"><a class='' href="/price/q-p1-k75.html">5万以下</a><a class=' s' href="/price/q-p2-k75.html">5-8万</a><a class='' href="/price/q-p3-k75.html">8-10万</a><a class='' href="/price/q-p4-k75.html">10-15万</a><a class='' href="/price/q-p5-k75.html">15-20万</a><a class='' href="/price/q-p6-k75.html">20-25万</a>......<div class="getTh">级别:</div><div class="umLimit"><a class='' href="/price/q-p2.html">不限</a></div><div class="Items"><a class=' ' href='/price/q-p2-k76.html'>微型车</a><a class=' ' href='/price/q-p2-k110.html'>小型车</a><a class=' ' href='/price/q-p2-k73.html'>紧凑型车</a><a class=' ' href='/price/q-p2-k72.html'>中型车</a><a class=' null' href='javascript:void(0)'>中大型车</a>
同样也是如此
常用的思路还是后台整合在url里面输出到前台吧。
ajiax 后台处理数据
最简单方式ajax 获取数据输出
其实问题的关键还是:“怎么通过某一事物的单一属性,判断其他属性是否存在”;
如果是 每点一次条件,都会到数据库里取一遍的话,这实现起来不难,比如点了一下
“5-8万” 这个条件,最笨的方法无非就是在后台
select * from auto_detail where market_price >= 50000 and market_price (假设auto_detail是一个存储了所有厂商的所有车型的详细资料表)
返回的结果可能有几百条,再对结果循环一遍,分别一一将返回集里的auto_grade,car_brand....(略);都存入一个二维数组里。
那“所有汽车级别,汽车品牌。。”等等这些数据哪来呢?无非再select distinct auto_grade from xxx 而已。
做好点的话把所有这种供对比的,不必经常更新的数据放缓存里面,就不用每次都去数据库查一遍了。
然后就简单了,分别判断一下,auto_grade里那些属性是有的,那些属性是没有的,再返回一个数组给jQuery,控制页面把样式改了就可以了。
以上是最笨的做法,权当抛砖引玉
这个是专用企业级搜索引擎!
查solr, sphix 和lucene!

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

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


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

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

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.
