Hình ảnh đầu tiên là mã của tôi. Tôi nhận được ID danh mục "Catid" và tiêu đề danh mục "Cattitle" từ trang trước, tuy nhiên, kết quả không hiển thị chính xác khi có/là một không gian/s trong tiêu đề. Làm cách nào để khắc phục điều này?
Bất kỳ sự giúp đỡ nào được đánh giá cao cảm ơn bạn Sam
Đã hỏi ngày 20 tháng 1 năm 2015 lúc 12:22Jan 20, 2015 at 12:22
2
Bạn có thể sử dụng các hàm UrlenCode ($ String) và Urldecode ($ String).
cho trường hợp của bạn
$catTitle = urldecode($_GET['catTitle']);%20 cho thấy bất cứ khi nào có không gian trong url stirng
Đã trả lời ngày 20 tháng 1 năm 2015 lúc 12:29Jan 20, 2015 at 12:29
kamlesh.barkamlesh.barkamlesh.bar
1.72417 Huy hiệu bạc36 Huy hiệu đồng17 silver badges36 bronze badges
1
Biểu tượng "&" là một ví dụ về ký tự đặc biệt trong XML và HTML được gọi là các thực thể và phải được dịch sang "& amp;"
Không sử dụng hàm ăn HTMLEntities để thực hiện dịch:
echo htmlentities($CatTitle);Cập nhật: Cũng xem xét rằng URL có thể được giải thích như thể $ _GET ["cattitle"] = "home" và $ _get ["bài viết"] = null. Có thể phải là: cattitle = home%20 &%20garden Trong trường hợp đó bạn có thể muốn sử dụng mã hóa URL trong khi tạo liên kết. Also consider that the URL may be interpreted as if the $_GET["CatTitle"]="Home " and the $_GET[" Articles"] = null. May be it should be: CatTitle=Home%20&%20Garden in which case you may want to use URL encode while genereting the link.
Đã trả lời ngày 20 tháng 1 năm 2015 lúc 12:31Jan 20, 2015 at 12:31
Borjabborjabborjab
10,6K6 Huy hiệu vàng68 Huy hiệu bạc95 Huy hiệu Đồng6 gold badges68 silver badges95 bronze badges
0
Tăng từ email người dùng
TagUI:
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result
PHP:
<?php echo "argv1 = " . $argv[1]; ?>
Làm thế nào để vượt qua đối số với các không gian như trên?
Chuyển những điều trên sẽ gây ra lỗi giống như email trước cho bạn:
- Trích dẫn duy nhất gây ra vấn đề
- Trích dẫn kép sẽ không hoạt động vì SH/Bash thực hiện thay thế thay đổi
Nếu tôi thay đổi ở trên mà không có trích dẫn duy nhất: chạy php -f php_test1.php thì đây là một chuỗi toàn bộ
run php -f php_test1.php this is one whole string
Nó chỉ trả về "điều này" không đúng. Muốn toàn bộ chuỗi là tham số 'Đây là một chuỗi toàn bộ'
Để được hỗ trợ và tư vấn, xin vui lòng.
2 năm trước
Ẩn danh ¶ — Pad a string to a certain length with another string
6 năm trước
Gene at swipesy dot com ¶(
string $string,
int $length,
string
$pad_string = " ",
int $pad_type = STR_PAD_RIGHT
): string
11 năm trước
Spudley ¶15 năm trước
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Fahad Dot Gilani tại Anu Dot Edu Dot Au ¶
Christian Dot Reinecke tại Web Dot de ¶BXI tại Rõa Dot NL ¶gtwizard ¶:
5 năm trước
14 năm trướcSTR_PAD_RIGHT, echo htmlentities($CatTitle); 9, or run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 0. If echo htmlentities($CatTitle); 6 is not specified it is assumed to be STR_PAD_RIGHT.
Kirill Fuchs ¶
zubfatal ¶
17 năm trước
matrebatre ¶str_pad() example
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 3
Kari " HaProg " Sderholm ¶ ¶
13 năm trước
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 4
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 5
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 6
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Email chấm riêng tại optusnet dot com dot au ¶ ¶
Bob [at] Bobarmadillo [dot] com ¶
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 8
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 9
<?php echo "argv1 = " . $argv[1]; ?> 0
<?php echo "argv1 = " . $argv[1]; ?> 1
<?php echo "argv1 = " . $argv[1]; ?> 2
<?php echo "argv1 = " . $argv[1]; ?> 3
<?php echo "argv1 = " . $argv[1]; ?> 4
<?php echo "argv1 = " . $argv[1]; ?> 0
<?php echo "argv1 = " . $argv[1]; ?> 6
<?php echo "argv1 = " . $argv[1]; ?> 2
<?php echo "argv1 = " . $argv[1]; ?> 8
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Wes tại nospamplsexample dot org ¶ ¶
7 năm trước
$string0
$string1
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Qeremy [atta] gmail [dotta] com ¶ ¶
9 năm trước
$string3
$string4
$string5
$string6Pestilenc tại hotmail dot com ¶
20 năm trước
$string7
$string8
$string9
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7MCINP ¶ ¶
7 năm trước
$length1
$length2
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Qeremy [atta] gmail [dotta] com ¶ ¶
9 năm trước
$length4
$length5
$length6
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Pestilenc tại hotmail dot com ¶
20 năm trước
$length8
$length9
$pad_string0
$pad_string1
$pad_string2
$pad_string3
$pad_string4MCINP ¶ ¶
Bob [at] Bobarmadillo [dot] com ¶
$pad_string5
$pad_string6
$pad_string7
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 719 năm trước ¶
Borszczuk
$pad_string9
$pad_type0
$pad_type1
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 71 tháng trước ¶
Neo_selen ¶
$pad_type3
$pad_type4
$pad_type5
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 72 năm trước ¶
Ẩn danh ¶
$pad_type7
$pad_type8
$pad_type9
6 năm trướcGene at swipesy dot com ¶ ¶
19 năm trước
STR_PAD_RIGHT1
STR_PAD_RIGHT2
STR_PAD_RIGHT3
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Christian Dot Reinecke tại Web Dot de ¶ ¶
15 năm trước
STR_PAD_RIGHT5
STR_PAD_RIGHT6
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7gtwizard ¶ ¶
5 năm trước
STR_PAD_RIGHT8
STR_PAD_RIGHT9
string0
string1
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7BXI tại Rõa Dot NL ¶ ¶
14 năm trước
string3
string4
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Kirill Fuchs ¶ ¶
5 năm trước
string6
string7
string8
string9
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7BXI tại Rõa Dot NL ¶ ¶
14 năm trước
echo htmlentities($CatTitle); 01
echo htmlentities($CatTitle); 02
echo htmlentities($CatTitle); 03Kirill Fuchs ¶ ¶
14 năm trước
echo htmlentities($CatTitle); 04
echo htmlentities($CatTitle); 05
echo htmlentities($CatTitle); 06
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Kirill Fuchs ¶ ¶
zubfatal ¶
echo htmlentities($CatTitle); 08
echo htmlentities($CatTitle); 09
echo htmlentities($CatTitle); 10
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 717 năm trước ¶
14 năm trước
echo htmlentities($CatTitle); 12
echo htmlentities($CatTitle); 13
echo htmlentities($CatTitle); 14
echo htmlentities($CatTitle); 15Kirill Fuchs ¶ ¶
zubfatal ¶
echo htmlentities($CatTitle); 16
echo htmlentities($CatTitle); 17
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 717 năm trước ¶
matrebatre ¶
echo htmlentities($CatTitle); 19
echo htmlentities($CatTitle); 20
echo htmlentities($CatTitle); 21
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7Kari " HaProg " Sderholm ¶ ¶
14 năm trước
echo htmlentities($CatTitle); 23
echo htmlentities($CatTitle); 24
echo htmlentities($CatTitle); 25
echo htmlentities($CatTitle); 26
echo htmlentities($CatTitle); 27Kirill Fuchs ¶ ¶
zubfatal ¶
echo htmlentities($CatTitle); 28
echo htmlentities($CatTitle); 29
17 năm trướcmatrebatre ¶ ¶
5 năm trước
echo htmlentities($CatTitle); 31
echo htmlentities($CatTitle); 32
echo htmlentities($CatTitle); 33
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7BXI tại Rõa Dot NL ¶ ¶
matrebatre ¶
echo htmlentities($CatTitle); 35
echo htmlentities($CatTitle); 36
echo htmlentities($CatTitle); 37
echo htmlentities($CatTitle); 38
run php -f php_test1.php 'this is one whole string' result = run_result echo "result = " + result 7