Hướng dẫn dùng anchors meaning trong PHP
Nội dung chính Show
Định nghĩa và sử dụngTag xác định một siêu liên kết
(hyperlink).
Xem ví dụ. Sự khác nhau giữa HTML4.01 và HTML5
Cấu trúcVí dụ: Liên kết tới trang khácHtml viết:Hiển thị trình duyệt:Ví dụ: Liên kết mailHtml viết:Hiển thị trình duyệt:Khi click vào sẽ xuất hiện một hộp thư gửi mail. Ví dụ: Link từ vị trí này tới vị trí khácHtml viết:Hiển thị trình duyệt:Ví dụ: Link để mở file word (tương tự cho những định dạng khác)Html viết:Mở file ex.doc trong thư mục "doc" Hiển thị trình duyệt:Ví dụ: Liên kết mở ra cửa sổ khácHtml viết:Hiển thị trình duyệt:Trình duyệt hỗ trợTag được hỗ trợ trong đa số các trình duyệt. Thuộc tínhThuộc tính tùy chọn
Thuộc tính Tổng quát và thuộc tính sự kiệnTất cả thuộc tính tổng quát và thuộc tính sự kiện được xác định trên phần lớn các thành phần HTML5 I try to use the anchor tag with the include I have. On my Index.php I got a little "nav bar" with some anchor tags. I also included the file "text.php" in my code. This file is in the Folder "texte". The anchor tags should bring the user to the position in text.php but it only load 404 - page not found. How I include the file:
I declare my "start-word" like this:
And my anchor like this:
I also tried Any ideas? asked Jul 31, 2019 at 10:58 qpAqpA 751 silver badge8 bronze badges 8 If
One think I noticed from your example is that you should make sure you use Clicking on an anchor link should not result in a 404 error, if it's correctly defined. Even if the anchor ID doesn't actually exist in the page, it still wouldn't give a 404 - the worst that would occur would be that nothing would happen. answered Jul 31, 2019 at 11:27 ADysonADyson 53.2k13 gold badges48 silver badges61 bronze badges Additionally to what @ADyson said: Anchor links work on the browser side. The form But I see, you are using includes, which work on server side. Normally, you don't have the same path and file structure on server and client (if your server include is located outside of wwwroot for example, but also for hiding confidential data and your program structure). This is most likely the reason why you see the 404. So if you want to access the piece of text that was included in your script, your redirect must not have a url. But for this to work, you need to define the anchor itself,
using answered Jul 31, 2019 at 11:38 Daniel AlderDaniel Alder 4,7302 gold badges46 silver badges51 bronze badges |