⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 phar.setalias.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Set the alias for the Phar archive</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="phar.running.html">Phar::running</a></div> <div class="next" style="text-align: right; float: right;"><a href="phar.setdefaultstub.html">Phar::setDefaultStub</a></div> <div class="up"><a href="class.Phar.html">Phar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="phar.setalias" class="refentry"> <div class="refnamediv">  <h1 class="refname">Phar::setAlias</h1>  <p class="verinfo">(PECL phar:1.2.1)</p><p class="refpurpose"><span class="refname">Phar::setAlias</span> &mdash; <span class="dc-title">Set the alias for the Phar archive</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">bool</span> <span class="methodname"><b><b>Phar::setAlias</b></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$alias</tt></span>   )</div>  <blockquote><p><b class="note">Note</b>: Thismethod requires the <var class="filename">php.ini</var> setting <i>phar.readonly</i> to beset to <i>0</i> in order to work for <a href="class.Phar.html" class="classname">Phar</a>objects.  Otherwise, a <a href="class.PharException.html" class="classname">PharException</a> will be thrown.<br /></p></blockquote>  <p class="para">   Set the alias for the Phar archive, and write it as the permanent alias   for this phar archive.  An alias can be used internally to a phar archive to   ensure that use of the <i>phar</i> stream wrapper to access internal   files always works regardless of the location of the phar archive on the   filesystem.  Another alternative is to rely upon Phar&#039;s interception of   <b>include()</b> or to use <a href="phar.interceptfilefuncs.html" class="function">Phar::interceptFileFuncs()</a>   and use relative paths.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">alias</tt></i></span>     <dd>      <p class="para">       A shorthand string that this archive can be referred to in <i>phar</i>       stream wrapper access.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">  </p> </div> <div class="refsect1 errors">  <h3 class="title">Errors/Exceptions</h3>  <p class="para">   Throws <b class="classname">UnexpectedValueException</b> when write access   is disabled, and <a href="class.PharException.html" class="classname">PharException</a> if the alias is   already in use or any problems were encountered flushing changes to disk.  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 A <b>Phar::setAlias()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$phar&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Phar</span><span style="color: #007700">(</span><span style="color: #DD0000">'myphar.phar'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$phar</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setAlias</span><span style="color: #007700">(</span><span style="color: #DD0000">'myp.phar'</span><span style="color: #007700">);<br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">Exception&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;handle&nbsp;error<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="phar.construct.html" class="function" rel="rdfs-seeAlso">Phar::__construct()</a></li>    <li class="member"><a href="phar.interceptfilefuncs.html" class="function" rel="rdfs-seeAlso">Phar::interceptFileFuncs()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="phar.running.html">Phar::running</a></div> <div class="next" style="text-align: right; float: right;"><a href="phar.setdefaultstub.html">Phar::setDefaultStub</a></div> <div class="up"><a href="class.Phar.html">Phar</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -