|
我是PHP新手,有两个简单的问题:
1) 如果:
<?php
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
?>
到底怎么才能echo/print出$text as the plain text. 就是说, 我要看到以下的print result (不要translate成html):
<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>
2) 怎么将每个String token 放入array 呢?
<?php
$text = 'This is my test';
?>
怎么变成$array('This','is','my','test') ? |
|
|
|
|
|
|
|
发表于 6-11-2007 10:32 AM
|
显示全部楼层
试试这两个function
explode
htmlspecialchars_decode |
|
|
|
|
|
|
|
发表于 6-11-2007 12:48 PM
|
显示全部楼层
如果我要刪除或換掉這logo要怎麼樣做?這是php form我式過用frontpage但再frontpage里只能看到它的coding而已........

這是它的coding....
-------------------------------------------------------------------------------------------
<?php
/*
+-------------------------------------------------------------------------
| CubeCart v3.0.15
| ========================================
| by Alistair Brookbanks
| CubeCart is a Trade Mark of Devellion Limited
| Copyright Devellion Limited 2005 - 2006. All rights reserved.
| Devellion Limited,
| 22 Thomas Heskin Court,
| Station Road,
| Bishops Stortford,
| HERTFORDSHIRE.
| CM23 3EE
| UNITED KINGDOM
| http://www.devellion.com
| UK Private Limited Company No. 5323904
| ========================================
| Web: http://www.cubecart.com
| Date: Thursday, 4th January 2007
| Email: sales (at) cubecart (dot) com
| License Type: CubeCart is NOT Open Source Software and Limitations Apply
| Licence Info: http://www.cubecart.com/site/faq/license.php
+-------------------------------------------------------------------------
| index.php
| ========================================
| Main pages of the store
+-------------------------------------------------------------------------
*/
include_once("includes/ini.inc.php");
// INCLUDE CORE VARIABLES & FUNCTIONS
include_once("includes/global.inc.php");
// check if installed
if($glob['installed']==0){
header("location: install/index.php");
exit;
} elseif((file_exists($glob['rootDir']."/install/index.php") || file_exists($glob['rootDir']."/upgrade.php") && $glob['installed']==1)){
echo "<strong>WARNING</strong> - Your store will not function until the install directory and/or upgrade.php is deleted from the server.";
exit;
}
// initiate db class
include_once("classes/db.inc.php");
$db = new db();
include_once("includes/functions.inc.php");
$config = fetchDbConfig("config");
include_once("includes/sessionStart.inc.php");
include_once("includes/sslSwitch.inc.php");
// get session data
include_once("includes/session.inc.php");
// get exchange rates etc
include_once("includes/currencyVars.inc.php");
$lang_folder = "";
if(empty($ccUserData[0]['lang'])){
$lang_folder = $config['defaultLang'];
} else {
$lang_folder = $ccUserData[0]['lang'];
}
include_once("language/".$lang_folder."/lang.inc.php");
// require template class
include_once("classes/xtpl.php");
$body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/index.tpl");
if(isset($_GET['searchStr'])){
$body->assign("SEARCHSTR",treatGet($_GET['searchStr']));
} else {
$body->assign("SEARCHSTR","");
}
$body->assign("CURRENCY_VER",$currencyVer);
$body->assign("VAL_ISO",$charsetIso);
$body->assign("VAL_SKIN",$config['skinDir']);
// START MAIN CONTENT
if(isset($_GET['act'])){
switch (treatGet($_GET['act'])) {
case "viewDoc":
include("includes/content/viewDoc.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "viewCat":
include("includes/content/viewCat.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "viewProd":
include("includes/content/viewProd.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "unsubscribe":
include("includes/content/unsubscribe.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "taf":
include("includes/content/tellafriend.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "login":
include("includes/content/login.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "logout":
include("includes/content/logout.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "forgotPass":
include("includes/content/forgotPass.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "account":
include("includes/content/account.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "profile":
include("includes/content/profile.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "changePass":
include("includes/content/changePass.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "newsletter":
include("includes/content/newsletter.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
case "dnExpire":
include("includes/content/dnExpire.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
default:
include("includes/content/index.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
break;
}
} else {
include("includes/content/index.inc.php");
$body->assign("PAGE_CONTENT",$page_content);
}
// END MAIN CONTENT
// START META DATA
if(isset($meta)){
$body->assign("META_TITLE",htmlspecialchars($meta['siteTitle']).c());
$body->assign("META_DESC",$meta['metaDescription']);
$body->assign("META_KEYWORDS",$config['metaKeyWords']);
} else {
$body->assign("META_TITLE",htmlspecialchars($config['siteTitle']).c());
$body->assign("META_DESC",$config['metaDescription']);
$body->assign("META_KEYWORDS",$config['metaKeyWords']);
}
// START CONTENT BOXES
include("includes/boxes/searchForm.inc.php");
$body->assign("SEARCH_FORM",$box_content);
include("includes/boxes/session.inc.php");
$body->assign("SESSION",$box_content);
include("includes/boxes/categories.inc.php");
$body->assign("CATEGORIES",$box_content);
include("includes/boxes/randomProd.inc.php");
$body->assign("RANDOM_PROD",$box_content);
include("includes/boxes/info.inc.php");
$body->assign("INFORMATION",$box_content);
include("includes/boxes/language.inc.php");
$body->assign("LANGUAGE",$box_content);
include("includes/boxes/currency.inc.php");
$body->assign("CURRENCY",$box_content);
include("includes/boxes/shoppingCart.inc.php");
$body->assign("SHOPPING_CART",$box_content);
include("includes/boxes/popularProducts.inc.php");
$body->assign("POPULAR_PRODUCTS",$box_content);
include("includes/boxes/saleItems.inc.php");
$body->assign("SALE_ITEMS",$box_content);
include("includes/boxes/mailList.inc.php");
$body->assign("MAIL_LIST",$box_content);
include("includes/boxes/siteDocs.inc.php");
$body->assign("SITE_DOCS",$box_content);
// END CONTENT BOXES
// parse and spit out final document
$body->parse("body");
$body->out("body");
?>
---------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
发表于 6-11-2007 03:57 PM
|
显示全部楼层
找img tag,然后盖掉它。  |
|
|
|
|
|
|
|
发表于 6-11-2007 08:58 PM
|
显示全部楼层
回复 #4 hui_wooi 的帖子
what is "img tag"?是不是那image的link?要怎樣找?上面的coding里有沒有img tag? |
|
|
|
|
|
|
|
发表于 6-11-2007 09:20 PM
|
显示全部楼层
既然你是用open source。
我想open source都有一个控制台。
到控制台找找吧。 |
|
|
|
|
|
|
|
发表于 7-11-2007 10:57 AM
|
显示全部楼层
index.php?act=viewDoc&docId=1
請問 以上的link是what meaning ?
act --> action right ?
viewdoc --> means to view a document file in the same dir?
docId=1 --> ??
 |
|
|
|
|
|
|
|
发表于 7-11-2007 11:42 AM
|
显示全部楼层
act和docId是variable。
viewDoc和1是value。
尝试在这里学PHP吧。 |
|
|
|
|
|
|
|

楼主 |
发表于 7-11-2007 02:25 PM
|
显示全部楼层
回复 #2 hui_wooi 的帖子
如果:
- $str = '<ul class="menu">
- <li class="leaf"><a href="/mysite/?q=L1/add">List 1</a></li>
- <li class="leaf"><a href="/mysite/?q=L2">List 2</a></li>
- <li class="leaf"><a href="/mysite/?q=L3">List 3</a></li>
- </ul>
- </div>‘;
- 怎么才能变成
- $array('<a href="/mysite/?q=L1/add">List 1</a>', '<a href="/mysite/?q=L2">List 2</a>',’<a href="/mysite/?q=L3">List 3</a>‘) ?
复制代码 |
|
|
|
|
|
|
|
发表于 14-11-2007 10:44 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 14-11-2007 11:01 AM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 16-11-2007 03:31 PM
|
显示全部楼层
可以解释给我知道 print <<<abc 这项功能吗? |
|
|
|
|
|
|
|
发表于 16-11-2007 03:32 PM
|
显示全部楼层
可以解释给我知道 print <<<abc 这项功能吗? |
|
|
|
|
|
|
|
发表于 16-11-2007 05:45 PM
|
显示全部楼层
回复 #13 black_bird 的帖子
这是perl的写法,叫做heredoc语法 。。。在某种情况下,蛮好用的,例如你要将整个xml的脚本存储在file内,你可以这么做
$myxml = <<<abc
<xml>
<ikanyu weight="45" length="20"/>
<blackbird weight="23" height="30"/>
</xml>
abc;
fopen ... fputs($myxml) ... fclose ...
它使到code更容易看更容易明白
abc 是一个用来ending string的标记。。。  |
|
|
|
|
|
|
|
发表于 16-11-2007 06:45 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 16-11-2007 08:21 PM
|
显示全部楼层
原帖由 ikanyuchiew 于 16-11-2007 05:45 PM 发表 
这是perl的写法,叫做heredoc语法 。。。在某种情况下,蛮好用的,例如你要将整个xml的脚本存储在file内,你可以这么做
$myxml =
这个方法是很方便但是很多text editor不能正常的解析而且代码看起来会很凌乱. |
|
|
|
|
|
|
|
发表于 17-11-2007 06:49 PM
|
显示全部楼层
可以這樣寫:
<?php
ob_start();
?>
<xml>
<ikanyu weight="45" length="20"/>
<blackbird weight="23" height="30"/>
</xml>
<?php
$buffer = ob_get_contents();
@ob_end_clean();
echo $buffer;
?> |
|
|
|
|
|
|
| |
本周最热论坛帖子
|