我不确定这个问题是我的嘘声还是关于 CI 的问题。我有一个 preg_replace 进程将已发布的 gdoc 电子表格 url 转换回原始电子表格 url。
$pat ='/(^[a-z\/\.\:]*?sheet\/)(pub)([a-zA-Z0-9\=\?]*)(\&output\=html)/';
$rep ='$1ccc$3#gid=0';
$theoriginal = preg_replace( $pat, $rep, $published );
这在本地运行的测试页面中运行良好。这个测试页面不是由 CI 构建的——它只是一个基本的 php 页面。
当我将模式和替换复制并粘贴到它打算用于的 CI 视图中时,没有任何乐趣。
这个故障是由 CI 还是我的“坏”引起的?是否有易于实施的补救措施?
下面是来自 CI 视图的更多代码:
<body id="sites" >
<?php
foreach ( $dets as $item )
{
$nona = $item->nona;
$address = $item->address;
$town = $item->town;
$pc = $item->pc;
$foto1 = $item->foto1;
$foto1txt = $item->foto1txt;
$foto2 = $item->foto2;
$foto2txt = $item->foto2txt;
$costurl = $item->costurl;
$sid = $item->sid;
}
//convert published spreadsheet url to gdoc spreadsheet url
$pat ='/(^[a-z\/\.\:]*?sheet\/)(pub)([a-zA-Z0-9\=\?]*)(\&output\=html)/i';
$rep ='$1ccc$3#gid=0';
$spreadsheet = preg_replace( $pat, $rep, $costurl);
汤姆