数组:
Array( [doctorcomment] => Array ( [0] => Array ( [status] => success [strcommenttype] => 1 [strcommentcontent] => 萨达 [strcreatetime] => 2014-08-20 [strusername] => wanhui [struserip] => 121.101.220.243 [strmobile] => 13910527603 ) [1] => Array ( [status] => success [strcommenttype] => 2 [strcommentcontent] => sdfsd [strcreatetime] => 2014-08-20 [strusername] => sdfds [struserip] => 343.2432.432 [strmobile] => 18600085268 ) [2] => Array ( [status] => success [strcommenttype] => 9 [strcommentcontent] => fsfddsf [strcreatetime] => 2014-08-20 [strusername] => sdfdsdfd [struserip] => 343.2432.432 [strmobile] => 18600085268 ) ) )
<?if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) && is_array($arrGetDoctorComment) ) { foreach ($arrGetDoctorComment as $arr_3) { foreach ($arr_3 as $value_3) { print_r($arr_3); if ( $value_3['strcommenttype'] == "9" ) { echo "<p style=\"font-size:14px;\">".$value_3['strcommentcontent']."</p>"; echo "<br/>"; echo "<span style=\"color:#757575;padding-bottom:10px;\">来自".$value_3['strusername']." ".$value_3['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } } } }?>
麻烦问问,我为什么取不出是3的值呢,取3的值的时候取的是1的值
回复讨论(解决方案)
3 在哪里?
foreach ($arrGetDoctorComment as $arr_3) { if ( $arr_3['strcommenttype'] == "9" ) { echo "<p style=\"font-size:14px;\">".$value_3['strcommentcontent']."</p>"; echo "<br/>"; echo "<span style=\"color:#757575;padding-bottom:10px;\">来自".$value_3['strusername']." ".$value_3['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } }
3 在哪里?
foreach ($arrGetDoctorComment as $arr_3) { if ( $arr_3['strcommenttype'] == "9" ) { echo "<p style=\"font-size:14px;\">".$value_3['strcommentcontent']."</p>"; echo "<br/>"; echo "<span style=\"color:#757575;padding-bottom:10px;\">来自".$value_3['strusername']." ".$value_3['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } }
抱歉看错了,是第2个,我想取出2里面, [strcommenttype] 值是9的
你的代码不是对的吗,有什么问题?
你的代码不是对的吗,有什么问题?
我在该显示2的地方没显示出来,显示的是0的信息。
你的代码不是对的吗,有什么问题?
<ul id="tab"> <li class="on" id="tab_1" onclick="switchTab(1)">好评(100)</li> <li id="tab_2" onclick="switchTab(2)">中评(1000)</li> <li id="tab_3" onclick="switchTab(3)" style="width:36%;margin: 0 -1px;">差评(1000)</li> </ul> <ul id="tab_con"> <li id="tab_con_1"> <li id="tab_con_1"> <? if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) && is_array($arrGetDoctorComment) ) { foreach ($arrGetDoctorComment as $arr_3) { foreach ($arr_3 as $value_3) { if ( $value_3['strcommenttype'] == "3" ) { echo "<p class=\"fCol\">".$value_3['strcommentcontent']."</p>"; echo "<br/>"; echo "<span>来自".$value_3['strusername']." ".$value_3['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } } } } ?> <? if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) ) { for ( $i=0; $i < count( $arrGetDoctorComment ); $i++ ) { if ( isset($arrGetDoctorComment['doctorcomment'][$i]['strcommenttype']) && !empty($arrGetDoctorComment['doctorcomment'][$i]['strcommenttype']) && $arrGetDoctorComment['doctorcomment'][$i]['strcommenttype'] == "1" ) { ?> <p><?=$arrGetDoctorComment['doctorcomment'][$i]['strcommentcontent'];?></p> <br/> <p class="fCol">来自<?=$arrGetDoctorComment['doctorcomment'][$i]['strusername'];?> <?=$arrGetDoctorComment['doctorcomment'][$i]['strcreatetime'];?></p> <br/> <hr/> <? } } } ?> </li> <li id="tab_con_2"> <? if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) && is_array($arrGetDoctorComment) ) { foreach ($arrGetDoctorComment as $arr_2) { foreach ($arr_2 as $value_2) { if ( $value_2['strcommenttype'] == "3" ) { echo "<p style=\"font-size:14px;\">".$value_2['strcommentcontent']."</p>"; echo "<br/>"; echo "<span style=\"color:#757575;padding-bottom:10px;\">来自".$value_2['strusername']." ".$value_2['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } } } } ?> </li> <li id="tab_con_3"> <? if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) && is_array($arrGetDoctorComment) ) { foreach ($arrGetDoctorComment as $arr_3) { foreach ($arr_3 as $value_3) { if ( $value_3['strcommenttype'] == "3" ) { echo "<p style=\"font-size:14px;\">".$value_3['strcommentcontent']."</p>"; echo "<br/>"; echo "<span style=\"color:#757575;padding-bottom:10px;\">来自".$value_3['strusername']." ".$value_3['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } } } } ?> </li> </ul>
$arrGetDoctorComment值见最上。
我在tab_con_3,tab_con_2,tab_con_1里面显示的都是“萨达”
你每一节都是 if ( $value_3['strcommenttype'] == "3" ) {
自然结果都是一样的
你每一节都是 if ( $value_3['strcommenttype'] == "3" ) {
自然结果都是一样的
这个问题我已经看到了,我 修改后结果还是一样,每个labe都有1的内容,麻烦群主给看一下。
http://m.gstzy.cn/comment/doctorcomment.php?doctorid=335
你 #5 的代码得不到连接中的效果
但也不能排除第7行未封闭的 li 在你的浏览器中作怪
你 #5 的代码得不到连接中的效果
但也不能排除第7行未封闭的 li 在你的浏览器中作怪
<ul id="tab_con"> <li id="tab_con_1"> <li id="tab_con_1"> <? if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) && is_array($arrGetDoctorComment) ) { foreach ($arrGetDoctorComment as $arr_1) { foreach ($arr_1 as $value_1) { if ( $value_1['strcommenttype'] == "1" ) { echo "<p class=\"fCol\">".$value_1['strcommentcontent']."</p>"; echo "<br/>"; echo "<span>来自".$value_1['strusername']." ".$value_1['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } } } } ?> </li> <li id="tab_con_2"> <? if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) && is_array($arrGetDoctorComment) ) { foreach ($arrGetDoctorComment as $arr_2) { foreach ($arr_2 as $value_2) { if ( $value_2['strcommenttype'] == "2" ) { echo "<p style=\"font-size:14px;\">".$value_2['strcommentcontent']."</p>"; echo "<br/>"; echo "<span style=\"color:#757575;padding-bottom:10px;\">来自".$value_2['strusername']." ".$value_2['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } } } } ?> </li> <li id="tab_con_3"> <? if( isset($arrGetDoctorComment) && !empty($arrGetDoctorComment) && is_array($arrGetDoctorComment) ) { foreach ($arrGetDoctorComment as $arr_3) { foreach ($arr_3 as $value_3) { if ( $value_3['strcommenttype'] == "3" ) { echo "<p style=\"font-size:14px;\">".$value_3['strcommentcontent']."</p>"; echo "<br/>"; echo "<span style=\"color:#757575;padding-bottom:10px;\">来自".$value_3['strusername']." ".$value_3['strcreatetime']."></span>"; echo "<br/>"; echo "<hr/>"; } else { echo "null date"; } } } } ?> </li> </ul>
就是连接的问题没有找到,我是在每一个tab都有关闭啊,麻烦路过的也看看,谢谢
你不觉得有问题吗?
你不觉得有问题吗?
谢谢

要保護應用免受與會話相關的XSS攻擊,需採取以下措施:1.設置HttpOnly和Secure標誌保護會話cookie。 2.對所有用戶輸入進行輸出編碼。 3.實施內容安全策略(CSP)限制腳本來源。通過這些策略,可以有效防護會話相關的XSS攻擊,確保用戶數據安全。

优化PHP会话性能的方法包括:1.延迟会话启动,2.使用数据库存储会话,3.压缩会话数据,4.管理会话生命周期,5.实现会话共享。这些策略能显著提升应用在高并发环境下的效率。

theSession.gc_maxlifetimesettinginphpdeterminesthelifespanofsessiondata,setInSeconds.1)它'sconfiguredinphp.iniorviaini_set().2)abalanceisesneededeededeedeedeededto toavoidperformance andunununununexpectedLogOgouts.3)

在PHP中,可以使用session_name()函數配置會話名稱。具體步驟如下:1.使用session_name()函數設置會話名稱,例如session_name("my_session")。 2.在設置會話名稱後,調用session_start()啟動會話。配置會話名稱可以避免多應用間的會話數據衝突,並增強安全性,但需注意會話名稱的唯一性、安全性、長度和設置時機。

會話ID應在登錄時、敏感操作前和每30分鐘定期重新生成。 1.登錄時重新生成會話ID可防會話固定攻擊。 2.敏感操作前重新生成提高安全性。 3.定期重新生成降低長期利用風險,但需權衡用戶體驗。

在PHP中設置會話cookie參數可以通過session_set_cookie_params()函數實現。 1)使用該函數設置參數,如過期時間、路徑、域名、安全標誌等;2)調用session_start()使參數生效;3)根據需求動態調整參數,如用戶登錄狀態;4)注意設置secure和httponly標誌以提升安全性。

在PHP中使用會話的主要目的是維護用戶在不同頁面之間的狀態。 1)會話通過session_start()函數啟動,創建唯一會話ID並存儲在用戶cookie中。 2)會話數據保存在服務器上,允許在不同請求間傳遞數據,如登錄狀態和購物車內容。

如何在子域名間共享會話?通過設置通用域名的會話cookie實現。 1.在服務器端設置會話cookie的域為.example.com。 2.選擇合適的會話存儲方式,如內存、數據庫或分佈式緩存。 3.通過cookie傳遞會話ID,服務器根據ID檢索和更新會話數據。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

Dreamweaver Mac版
視覺化網頁開發工具

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中