แนะนำ: 20 ตัวอย่างที่มีประโยชน์มากในการเขียนโปรแกรม ASP (i) 1. วิธีใช้ ASP เพื่อกำหนดเส้นทางทางกายภาพเสมือนจริงของเว็บไซต์ของคุณคำตอบ: ใช้วิธี Mappath: < % = Server.mappath () %> 2 คำตอบ: ใช้วิธีการวัตถุคำขอ:
เมื่อเวลาผ่านไปเพื่อเพิ่มฟังก์ชั่นการสมัครสมาชิก RSS ในเว็บไซต์ภาพยนตร์ของฉันฉันเขียนรหัส ASP ที่สร้างฟีด RSS แบบไดนามิก ในฐานะที่เป็นเว็บไซต์ภาพยนตร์จะได้รับโดยตรง ฟีด RSS ที่สร้างขึ้นถูกเข้ารหัสโดย UTF-8 ได้รับการตรวจสอบโดย feedvalidator.org และเข้ากันได้กับ RSS 2.0 และอะตอม
วิธีใช้: บันทึกรหัสต่อไปนี้เป็น RSS.ASP (อย่าลืมบันทึกในรูปแบบ UTF-8) และอัปโหลดไปยังไดเรกทอรีรูทเว็บไซต์ ชื่อโดเมนของคุณ /rss.asp
ตัวอย่าง: http://www.366mv.cn
รหัสมีดังนี้
| <%@language = vbscript codepage = 65001%> - session.codepage = 65001 Response.charset = UTF-8 '===================================================== =================== =================================== 'Copyright (C) 2005-2007, Sour Liu Liu Film and Television ([URL] www.366mv.cn [/url]) สงวนลิขสิทธิ์ '===================================================== =================== =================================== 'ชื่อ: rss.asp 'คำอธิบาย: สร้างฟีด RSS แบบไดนามิก '===================================================== =================== =================================== - <!-#รวมไฟล์ = inc/conn.asp-> <? xml version = 1.0 encoding = utf-8?> <rss version = 2.0 xmlns: atom = http: //www.w3.org/2005/atom> - Title = Souliao Liu Film and Television'Change มันเป็นชื่อของคุณเอง Response.write <vannel> & Chr (13) Response.write <Atom: Link href = http: //&maxz_2&/xml.asp rel = self type = application/rss xml/> & chr (13) Response.write <tite> วิดีโอที่อัปเดตล่าสุด - & title & </title> & Chr (13) Response.write <Link> http: // & maxz_2 & </link> & Chr (13) Response.write <Scription> & Title & - ดูวิดีโอหนึ่งพันวิดีโอออนไลน์ ภาพยนตร์ฟรี, ภาพยนตร์ออนไลน์, TVB, ละครญี่ปุ่น, ละครเกาหลี, แอนิเมชั่น, นิยายวิทยาศาสตร์, สยองขวัญ, โรแมนติก, ทีวีซีรีส์, ภาพยนตร์เรื่องภาพยนตร์, ภาพยนตร์ปีใหม่ ... </คำอธิบาย> & Chr (13) response.write get_left (15,0) 'แสดงวิดีโอ 15 รายการแรกเรียงตามวันที่อัปเดต Response.write </channel> & Chr (13) ฟังก์ชั่น RE (STR) ถ้าไม่ใช่ isnull (str) แล้ว Re = แทนที่ (Str, &, &) Re = แทนที่ (re, <, <) Re = แทนที่ (re,>,>) Re = แทนที่ (re, ', & apos;) Re = แทนที่ (re ,,) สิ้นสุดถ้า ฟังก์ชันสิ้นสุด ฟังก์ชั่น get_left (n, m) n = cint (n): m = cint (m) ถ้า m = 1 แล้ว mm = สั่งซื้อโดย zt_hits desc 'เรียงลำดับโดยคลิก อื่น mm = สั่งซื้อโดย zt_date desc 'เรียงตามวันที่อัปเดต สิ้นสุดถ้า ตั้งค่า rs1 = conn.execute (เลือก Top & n & zt_id, zt_name, zt_zy, zt_dy, zt_type, zt_date, zt_hits, zt_content จาก zt_data & mm) get_left_i = 0 ทำในขณะที่ไม่ใช่ rs1.eof get_left_i = get_left_i 1 get_left = get_left & <item> & chr (13) get_left = get_left & <title> & re (rs1 (zt_name)) & </title> & chr (13) get_left = get_left & <link> http: // & maxz_2 &/& get_classenname (rs1 (zt_type)) &/& rs1 (zt_id) & </link> & Chr (13) get_left = get_left & <คำอธิบาย> <! [cdata [<p> หมวดหมู่: <a href = http: // & maxz_2 &/& get_classenname (rs1 (zt_type)) &> & get_classname (rs1 (zt_type) > <p> นำแสดงโดย: & rs1 (zt_zy) & </p> <p> พล็อต: & re (rs1 (zt_content)) & </p>]> </คำอธิบาย> & Chr (13) get_left = get_left & <uid> http: // & maxz_2 &/& get_classenname (rs1 (zt_type)) &/& rs1 (zt_id) & </duid> & chr (13) get_left = get_left & <category> <! [cdata [& get_classname (rs1 (zt_type))) &]> </category> & Chr (13) get_left = get_left & <bubdate> & detetorfc822 (rs1 (zt_date)) & </bubdate> & Chr (13) get_left = get_left & </item> & Chr (13) ถ้า get_left_i> = n จากนั้นออกจากทำ Rs1.Movenext วง rs1.close ฟังก์ชันสิ้นสุด ฟังก์ชั่น detetorfc822 (byval dtaval) Dim strcurlocale: strcurlocale = getLocale () Setlocale (en-gb) dtaval = cdate (dtaval) detetorfc822 = วันธรรมดา (วันธรรมดา (dtaval), true) &, & _ ขวา (0 & Day (dtaval), 2) & & _ MonthName (เดือน (dtaval), true) & & _ ปี (dtaval) & & _ ขวา (0 & ชั่วโมง (dtaval), 2) &: & _ ขวา (0 & นาที (dtaval), 2) &: & _ ขวา (0 & วินาที (dtaval), 2) & & _ 0800 setlocale (strcurlocale) ฟังก์ชันสิ้นสุด %> </rss> |
แบ่งปัน: ASP จะรับที่อยู่ภาพแรกในรหัสได้อย่างไร 'แก้ไขรูปแบบอีกครั้งรหัสเพื่อตรวจจับ code'http: //www.knowsky.com/asp.asp'leixing html หรือ ubb'nopic รหัสไม่มีฟังก์ชั่นรูปภาพ toppic (รหัส, leixing, nopic) ตั้งค่า regex = ne